1 // RUN: %clang_cc1 -std=c++1y -o - -emit-llvm -verify %s
2 // RUN: %clang_cc1 -std=c++1y -fexperimental-new-constant-interpreter -o - -emit-llvm -verify %s
4 namespace default_arg_temporary
{
6 constexpr bool equals(const float& arg
= 1.0f
) {
10 constexpr const int &x(const int &p
= 0) {
15 constexpr S(const int &a
= 0) {}
18 void test_default_arg2() {
19 // This piece of code used to cause an assertion failure in
20 // CallStackFrame::createTemporary because the same MTE is used to initilize
21 // both elements of the array (see PR33140).
22 constexpr S s
[2] = {};
24 // This piece of code used to cause an assertion failure in
25 // CallStackFrame::createTemporary because multiple CXXDefaultArgExpr share
26 // the same MTE (see PR33140).
27 static_assert(equals() && equals(), "");
29 // Test that constant expression evaluation produces distinct lvalues for
31 static_assert(&x() != &x(), "");
34 // Check that multiple CXXDefaultInitExprs don't cause an assertion failure.
35 struct A
{ int &&r
= 0; };
37 B b
= {}; // expected-no-diagnostics