1- // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
1+ // RUN: %clang_cc1 -fsyntax-only -verify=expected,until26 %s -std=c++11
2+ // RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx26 %s -std=c++26
23
34// Implicitly-defined default constructors are constexpr if the implicit
45// definition would be.
@@ -15,8 +16,9 @@ constexpr NonConstexpr2a nc2a = NonConstexpr2a(); // ok, does not call construct
1516constexpr int nc2_a = NonConstexpr2().nl.a; // ok
1617constexpr int nc2a_a = NonConstexpr2a().a; // ok
1718struct Helper {
18- friend constexpr NonConstexpr1::NonConstexpr1 (); // expected-error {{follows non-constexpr declaration}}
19- friend constexpr NonConstexpr2::NonConstexpr2 (); // expected-error {{follows non-constexpr declaration}}
19+ friend constexpr NonConstexpr1::NonConstexpr1 (); // until26-error {{follows non-constexpr declaration}} cxx26-error {{missing exception specification}}
20+ friend constexpr NonConstexpr2::NonConstexpr2 (); // until26-error {{follows non-constexpr declaration}} cxx26-error {{missing exception specification}}
21+
2022};
2123
2224struct Constexpr1 {};
@@ -31,14 +33,14 @@ constexpr Constexpr2 c2 = Constexpr2(); // ok
3133
3234int n;
3335struct Member {
34- Member () : a(n) {}
36+ Member () : a(n) {} // cxx26-note {{here}}
3537 constexpr Member (int &a) : a(a) {}
3638 int &a;
3739};
38- struct NonConstexpr4 { // expected -note {{here}}
40+ struct NonConstexpr4 { // until26 -note {{here}} cxx26-note {{non-constexpr constructor }}
3941 Member m;
4042};
41- constexpr NonConstexpr4 nc4 = NonConstexpr4(); // expected-error {{constant expression}} expected -note {{non-constexpr constructor 'NonConstexpr4'}}
43+ constexpr NonConstexpr4 nc4 = NonConstexpr4(); // expected-error {{constant expression}} until26 -note {{non-constexpr constructor 'NonConstexpr4'}} cxx26-note {{in call to }}
4244struct Constexpr3 {
4345 constexpr Constexpr3 () : m(n) {}
4446 Member m;
@@ -53,11 +55,11 @@ constexpr Constexpr4 c4 = Constexpr4(); // ok
5355// This rule breaks some legal C++98 programs!
5456struct A {}; // expected-note {{here}}
5557struct B {
56- friend A::A (); // expected -error {{non-constexpr declaration of 'A' follows constexpr declaration}}
58+ friend A::A (); // until26 -error {{non-constexpr declaration of 'A' follows constexpr declaration}} cxx26-error {{missing exception specification }}
5759};
5860
5961namespace UnionCtors {
60- union A { // expected -note {{here}}
62+ union A { // until26 -note {{here}}
6163 int a;
6264 int b;
6365 };
@@ -79,19 +81,19 @@ namespace UnionCtors {
7981 int d = 5 ;
8082 };
8183 };
82- struct E { // expected -note {{here}}
84+ struct E { // until26 -note {{here}}
8385 union {
8486 int a;
8587 int b;
8688 };
8789 };
8890
8991 struct Test {
90- friend constexpr A::A () noexcept ; // expected -error {{follows non-constexpr declaration}}
92+ friend constexpr A::A () noexcept ; // until26 -error {{follows non-constexpr declaration}}
9193 friend constexpr B::B () noexcept ;
9294 friend constexpr C::C () noexcept ;
9395 friend constexpr D::D () noexcept ;
94- friend constexpr E::E () noexcept ; // expected -error {{follows non-constexpr declaration}}
96+ friend constexpr E::E () noexcept ; // until26 -error {{follows non-constexpr declaration}}
9597 };
9698}
9799
@@ -122,6 +124,6 @@ namespace PR48763 {
122124
123125 struct G { G(); };
124126 struct H : D { using D::D; H(int ); G g; };
125- union V { H h; }; // expected -note {{field 'h' has a non-trivial default constructor}}
126- V v; // expected -error {{deleted}}
127+ union V { H h; }; // until26 -note {{field 'h' has a non-trivial default constructor}}
128+ V v; // until26 -error {{deleted}}
127129}
0 commit comments