1 // RUN: %clang_cc1 -fsyntax-only %s -std=c++14
3 // Checks that Clang doesn't crash/assert on the nested call to "kaboom"
6 // This is an interesting test case for `ExprConstant.cpp`'s `CallStackFrame`
7 // because it triggers the following chain of events:
8 // 0. `CheckEnableIf` calls `EvaluateWithSubstitution`.
9 // 1. The outer call to "kaboom" gets evaluated.
10 // 2. The expr for "a" gets evaluated, it has a version X;
11 // a temporary with the key (a, X) is created.
12 // 3. The inner call to "kaboom" gets evaluated.
13 // 4. The expr for "a" gets evaluated, it has a version Y;
14 // a temporary with the key (a, Y) is created.
15 // 5. The expr for "b" gets evaluated, it has a version Y;
16 // a temporary with the key (b, Y) is created.
17 // 6. `EvaluateWithSubstitution` looks at "b" but cannot evaluate it
18 // because it's value-dependent (due to the call to "f.foo()").
20 // When `EvaluateWithSubstitution` bails out while evaluating the outer
21 // call, it attempts to fetch "b"'s param slot to clean it up.
23 // This used to cause an assertion failure in `getTemporary` because
24 // a temporary with the key "(b, Y)" (created at step 4) existed but
25 // not one for "(b, X)", which is what it was trying to fetch.
28 __attribute__((enable_if(true, "")))
42 kaboom(kaboom(0.0, 1.0), f
.foo());