diff options
Diffstat (limited to 'test/CXX/dcl.dcl')
-rw-r--r-- | test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp | 101 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp | 9 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp | 74 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.align/p6.cpp | 86 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp | 16 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.align/p8.cpp | 6 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp | 32 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp | 14 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.attr/dcl.attr.noreturn/p1.cpp | 44 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp | 3 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp | 3 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp | 22 | ||||
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp | 22 |
13 files changed, 427 insertions, 5 deletions
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp index 069ca0a..11372dd 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp @@ -91,3 +91,104 @@ namespace test5 { template void f<int>(int); template void f<long>(long); //expected-note {{instantiation}} } + +// rdar://13393749 +namespace test6 { + class A; + namespace ns { + class B { + static void foo(); // expected-note {{implicitly declared private here}} + friend union A; + }; + + union A { + void test() { + B::foo(); + } + }; + } + + class A { + void test() { + ns::B::foo(); // expected-error {{'foo' is a private member of 'test6::ns::B'}} + } + }; +} + +// We seem to be following a correct interpretation with these, but +// the standard could probably be a bit clearer. +namespace test7a { + namespace ns { + class A; + } + + using namespace ns; + class B { + static void foo(); + friend class A; + }; + + class ns::A { + void test() { + B::foo(); + } + }; +} +namespace test7b { + namespace ns { + class A; + } + + using ns::A; + class B { + static void foo(); + friend class A; + }; + + class ns::A { + void test() { + B::foo(); + } + }; +} +namespace test7c { + namespace ns1 { + class A; + } + + namespace ns2 { + // ns1::A appears as if declared in test7c according to [namespace.udir]p2. + // I think that means we aren't supposed to find it. + using namespace ns1; + class B { + static void foo(); // expected-note {{implicitly declared private here}} + friend class A; + }; + } + + class ns1::A { + void test() { + ns2::B::foo(); // expected-error {{'foo' is a private member of 'test7c::ns2::B'}} + } + }; +} +namespace test7d { + namespace ns1 { + class A; + } + + namespace ns2 { + // Honor the lexical context of a using-declaration, though. + using ns1::A; + class B { + static void foo(); + friend class A; + }; + } + + class ns1::A { + void test() { + ns2::B::foo(); + } + }; +} diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp index ae40062..a38ff15 100644 --- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp +++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p10.cpp @@ -33,3 +33,12 @@ namespace test1 { } } +// PR 14768 +namespace PR14768 { + template<typename eT> class Mat; + template<typename eT> class Col : public Mat<eT> { + using Mat<eT>::operator(); + using Col<eT>::operator(); + void operator() (); + }; +} diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp new file mode 100644 index 0000000..10be98d --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp @@ -0,0 +1,74 @@ +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -verify %s + +alignas(1) int n1; // expected-error {{requested alignment is less than minimum alignment of 4 for type 'int'}} +alignas(1) alignas(2) int n2; // expected-error {{less than minimum alignment}} +alignas(1) alignas(2) alignas(4) int n3; // ok +alignas(1) alignas(2) alignas(0) int n4; // expected-error {{less than minimum alignment}} +alignas(1) alignas(2) int n5 alignas(4); // ok +alignas(1) alignas(4) int n6 alignas(2); // ok +alignas(1) int n7 alignas(2), // expected-error {{less than minimum alignment}} + n8 alignas(4); // ok +alignas(8) int n9 alignas(2); // ok, overaligned + +enum alignas(1) E1 {}; // expected-error {{requested alignment is less than minimum alignment of 4 for type 'E1'}} +enum alignas(1) E2 : char {}; // ok +enum alignas(4) E3 { e3 = 0 }; // ok +enum alignas(4) E4 { e4 = 1ull << 33 }; // expected-error {{requested alignment is less than minimum alignment of 8 for type 'E4'}} + +struct S1 { + alignas(8) int n; +}; +struct alignas(2) S2 { // expected-error {{requested alignment is less than minimum alignment of 4 for type 'S2'}} + int n; +}; +struct alignas(2) S3 { // expected-error {{requested alignment is less than minimum alignment of 8 for type 'S3'}} + S1 s1; +}; +struct alignas(2) S4 : S1 { // expected-error {{requested alignment is less than minimum alignment of 8 for type 'S4'}} +}; +struct S5 : S1 { + alignas(2) S1 s1; // expected-error {{requested alignment is less than minimum alignment of 8 for type 'S1'}} +}; +struct S6 { + S1 s1; +}; +struct S7 : S1 { +}; +struct alignas(2) alignas(8) alignas(1) S8 : S1 { +}; + +S1 s1 alignas(4); // expected-error {{requested alignment is less than minimum alignment of 8 for type 'S1'}} +S6 s6 alignas(4); // expected-error {{requested alignment is less than minimum alignment of 8 for type 'S6'}} +S7 s7 alignas(4); // expected-error {{requested alignment is less than minimum alignment of 8 for type 'S7'}} + +template<int N, int M, typename T> +struct alignas(N) X { // expected-error 3{{requested alignment is less than minimum}} + alignas(M) T t; // expected-error 3{{requested alignment is less than minimum}} +}; + +template struct X<1, 1, char>; +template struct X<4, 1, char>; +template struct X<1, 2, char>; // expected-note {{instantiation}} +template struct X<1, 1, short>; // expected-note {{instantiation}} +template struct X<2, 1, short>; // expected-note {{instantiation}} +template struct X<2, 2, short>; +template struct X<16, 8, S1>; +template struct X<4, 4, S1>; // expected-note {{instantiation}} + +template<int N, typename T> +struct Y { + enum alignas(N) E : T {}; // expected-error {{requested alignment is less than minimum}} +}; +template struct Y<1, char>; +template struct Y<2, char>; +template struct Y<1, short>; // expected-note {{instantiation}} +template struct Y<2, short>; + +template<int N, typename T> +void f() { + alignas(N) T v; // expected-error {{requested alignment is less than minimum}} +}; +template void f<1, char>(); +template void f<2, char>(); +template void f<1, short>(); // expected-note {{instantiation}} +template void f<2, short>(); diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p6.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p6.cpp new file mode 100644 index 0000000..e788577 --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p6.cpp @@ -0,0 +1,86 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +alignas(4) extern int n1; // expected-note {{previous declaration}} +alignas(8) int n1; // expected-error {{redeclaration has different alignment requirement (8 vs 4)}} + +alignas(8) int n2; // expected-note {{previous declaration}} +alignas(4) extern int n2; // expected-error {{different alignment requirement (4 vs 8)}} + +alignas(8) extern int n3; // expected-note {{previous declaration}} +alignas(4) extern int n3; // expected-error {{different alignment requirement (4 vs 8)}} + +extern int n4; +alignas(8) extern int n4; + +alignas(8) extern int n5; +extern int n5; + +int n6; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} +alignas(8) extern int n6; // expected-note {{declared with 'alignas' attribute here}} + +extern int n7; +alignas(8) int n7; + +alignas(8) extern int n8; // expected-note {{declared with 'alignas' attribute here}} +int n8; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} + +int n9; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} +alignas(4) extern int n9; // expected-note {{declared with 'alignas' attribute here}} + + +enum alignas(2) E : char; // expected-note {{declared with 'alignas' attribute here}} +enum E : char {}; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} + +enum alignas(4) F : char; // expected-note {{previous declaration is here}} +enum alignas(2) F : char; // expected-error {{redeclaration has different alignment requirement (2 vs 4)}} + +enum G : char; +enum alignas(8) G : char {}; +enum G : char; + +enum H : char {}; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} +enum alignas(1) H : char; // expected-note {{declared with 'alignas' attribute here}} + + +struct S; +struct alignas(16) S; // expected-note {{declared with 'alignas' attribute here}} +struct S; +struct S { int n; }; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} + +struct alignas(2) T; +struct alignas(2) T { char c; }; // expected-note {{previous declaration is here}} +struct T; +struct alignas(4) T; // expected-error {{redeclaration has different alignment requirement (4 vs 2)}} + +struct U; +struct alignas(2) U {}; + +struct V {}; // expected-error {{'alignas' must be specified on definition if it is specified on any declaration}} +struct alignas(1) V; // expected-note {{declared with 'alignas' attribute here}} + +template<int M, int N> struct alignas(M) W; +template<int M, int N> struct alignas(N) W {}; +W<4,4> w44; // ok +// FIXME: We should reject this. +W<1,2> w12; +static_assert(alignof(W<4,4>) == 4, ""); + +template<int M, int N, int O, int P> struct X { + alignas(M) alignas(N) static char Buffer[32]; // expected-note {{previous declaration is here}} +}; +template<int M, int N, int O, int P> +alignas(O) alignas(P) char X<M, N, O, P>::Buffer[32]; // expected-error {{redeclaration has different alignment requirement (8 vs 2)}} +char *x1848 = X<1,8,4,8>::Buffer; // ok +char *x1248 = X<1,2,4,8>::Buffer; // expected-note {{in instantiation of}} + +template<int M, int N, int O, int P> struct Y { + enum alignas(M) alignas(N) E : char; +}; +template<int M, int N, int O, int P> +enum alignas(O) alignas(P) Y<M,N,O,P>::E : char { e }; +int y1848 = Y<1,8,4,8>::e; +// FIXME: We should reject this. +int y1248 = Y<1,2,4,8>::e; + +// Don't crash here. +alignas(4) struct Incomplete incomplete; // expected-error {{incomplete type}} expected-note {{forward declaration}} diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp new file mode 100644 index 0000000..93b1c64 --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p7.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +template<typename T, typename A, int N> struct X { + alignas(T) alignas(A) T buffer[N]; +}; + +static_assert(alignof(X<char, int, sizeof(int)>) == alignof(int), ""); +static_assert(alignof(X<int, char, 1>) == alignof(int), ""); + + +template<typename T, typename A, int N> struct Y { + alignas(A) T buffer[N]; // expected-error {{requested alignment is less than minimum alignment of 4 for type 'int [1]'}} +}; + +static_assert(alignof(Y<char, int, sizeof(int)>) == alignof(int), ""); +static_assert(alignof(Y<int, char, 1>) == alignof(int), ""); // expected-note {{in instantiation of}} diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p8.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p8.cpp new file mode 100644 index 0000000..686aac2 --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p8.cpp @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -std=c++11 -verify %s + +alignas(double) void f(); // expected-error {{'alignas' attribute only applies to variables, data members and tag types}} +alignas(double) unsigned char c[sizeof(double)]; // expected-note {{previous}} +extern unsigned char c[sizeof(double)]; +alignas(float) extern unsigned char c[sizeof(double)]; // expected-error {{different alignment}} diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp new file mode 100644 index 0000000..9f7ef3a --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p1.cpp @@ -0,0 +1,32 @@ +// RUN: %clang_cc1 -verify -std=c++11 %s + +[[carries_dependency, carries_dependency]] int m1(); // expected-error {{attribute 'carries_dependency' cannot appear multiple times in an attribute specifier}} +[[carries_dependency]] [[carries_dependency]] int m2(); // ok +[[carries_dependency()]] int m3(); // expected-error {{attribute 'carries_dependency' cannot have an argument list}} + +[[carries_dependency]] void f1(); // FIXME: warn here +[[carries_dependency]] int f2(); // ok +int f3(int param [[carries_dependency]]); // ok +[[carries_dependency]] int (*f4)(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}} +int (*f5 [[carries_dependency]])(); // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}} +int (*f6)() [[carries_dependency]]; // expected-error {{'carries_dependency' attribute cannot be applied to types}} +int (*f7)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}} +int (((f8)))(int n [[carries_dependency]]); // ok +int (*f9(int n))(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}} +int typedef f10(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}} +using T = int(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}} +struct S { + [[carries_dependency]] int f(int n [[carries_dependency]]); // ok + int (*p)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}} +}; +void f() { + [[carries_dependency]] int f(int n [[carries_dependency]]); // ok + [[carries_dependency]] // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}} + int (*p)(int n [[carries_dependency]]); // expected-error {{'[[carries_dependency]]' attribute only allowed on parameter in a function declaration}} +} + +auto l1 = [](int n [[carries_dependency]]) {}; +// There's no way to write a lambda such that the return value carries +// a dependency, because an attribute applied to the lambda appertains to +// the *type* of the operator() function, not to the function itself. +auto l2 = []() [[carries_dependency]] {}; // expected-error {{'carries_dependency' attribute cannot be applied to types}} diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp new file mode 100644 index 0000000..d5b0ebf --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.depend/p2.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -verify -std=c++11 %s + +int f(int); // expected-note 2{{declaration missing '[[carries_dependency]]' attribute is here}} +[[carries_dependency]] int f(int); // expected-error {{function declared '[[carries_dependency]]' after its first declaration}} +int f(int n [[carries_dependency]]); // expected-error {{parameter declared '[[carries_dependency]]' after its first declaration}} + +int g([[carries_dependency]] int n); // expected-note {{declaration missing '[[carries_dependency]]' attribute is here}} +int g(int); +[[carries_dependency]] int g(int); // expected-error {{function declared '[[carries_dependency]]' after its first declaration}} +int g(int n [[carries_dependency]]); + +int h [[carries_dependency]](); +int h(); +[[carries_dependency]] int h(); diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.noreturn/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.noreturn/p1.cpp new file mode 100644 index 0000000..0af241f --- /dev/null +++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.noreturn/p1.cpp @@ -0,0 +1,44 @@ +// RUN: %clang_cc1 -std=c++11 -verify -fcxx-exceptions %s + +[[noreturn]] void a() { + return; // expected-warning {{function 'a' declared 'noreturn' should not return}} +} +void a2 [[noreturn]] () { + return; // expected-warning {{function 'a2' declared 'noreturn' should not return}} +} + +[[noreturn, noreturn]] void b() { throw 0; } // expected-error {{attribute 'noreturn' cannot appear multiple times in an attribute specifier}} +[[noreturn]] [[noreturn]] void b2() { throw 0; } // ok + +[[noreturn()]] void c(); // expected-error {{attribute 'noreturn' cannot have an argument list}} + +void d() [[noreturn]]; // expected-error {{'noreturn' attribute cannot be applied to types}} +int d2 [[noreturn]]; // expected-error {{'noreturn' attribute only applies to functions and methods}} + +[[noreturn]] int e() { b2(); } // ok + +int f(); // expected-note {{declaration missing '[[noreturn]]' attribute is here}} +[[noreturn]] int f(); // expected-error {{function declared '[[noreturn]]' after its first declaration}} +int f(); + +[[noreturn]] int g(); +int g() { while (true) b(); } // ok +[[noreturn]] int g(); + +[[gnu::noreturn]] int h(); + +template<typename T> void test_type(T) { T::error; } // expected-error {{has no members}} +template<> void test_type(int (*)()) {} + +void check() { + // We do not consider [[noreturn]] to be part of the function's type. + // However, we do treat [[gnu::noreturn]] as being part of the type. + // + // This isn't quite GCC-compatible; it treats [[gnu::noreturn]] as + // being part of a function *pointer* type, but not being part of + // a function type. + test_type(e); + test_type(f); + test_type(g); + test_type(h); // expected-note {{instantiation}} +} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp index 6820fc6..a3a964a 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp @@ -25,8 +25,9 @@ constexpr notlit nl1; // expected-error {{constexpr variable cannot have non-lit void f2(constexpr int i) {} // expected-error {{function parameter cannot be constexpr}} // non-static member struct s2 { - constexpr int mi1; // expected-error {{non-static data member cannot be constexpr}} + constexpr int mi1; // expected-error {{non-static data member cannot be constexpr; did you intend to make it const?}} static constexpr int mi2; // expected-error {{requires an initializer}} + mutable constexpr int mi3 = 3; // expected-error-re {{non-static data member cannot be constexpr$}} expected-error {{'mutable' and 'const' cannot be mixed}} }; // typedef typedef constexpr int CI; // expected-error {{typedef cannot be constexpr}} diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp index dfc1d3d..ad156c8 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp @@ -272,9 +272,8 @@ namespace CtorLookup { struct A { constexpr A(const A&) {} A(A&) {} - constexpr A(int); // expected-note {{previous}} + constexpr A(int = 0); }; - constexpr A::A(int = 0) {} // expected-warning {{default constructor}} struct B : A { B() = default; diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp index 3c1152c..bca73ee 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -verify -std=c++11 -fcxx-exceptions %s -// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s -DNO_INVALID_CONSTEXPR namespace StdExample { @@ -110,3 +110,23 @@ int y1 = Y<int>().get(); // ok int y2 = Y<Z>().get(); // ok } + +#ifndef NO_INVALID_CONSTEXPR +namespace PR14550 { + // As an "extension", we allow functions which can't produce constant + // expressions to be declared constexpr in system headers (libstdc++ + // marks some functions as constexpr which use builtins which we don't + // support constant folding). Ensure that we don't mark those functions + // as invalid after suppressing the diagnostic. +# 122 "p5.cpp" 1 3 + int n; + struct A { + static constexpr int f() { return n; } + }; + template<typename T> struct B { + B() { g(T::f()); } // expected-error {{undeclared identifier 'g'}} + }; +# 130 "p5.cpp" 2 + template class B<A>; // expected-note {{here}} +} +#endif diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp index c4935b3..344f8ce 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp @@ -1,19 +1,39 @@ // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s +using size_t = decltype(sizeof(int)); + struct S { constexpr int f(); constexpr int g() const; + constexpr int h(); + int h(); static constexpr int Sf(); + /*static*/ constexpr void *operator new(size_t) noexcept; + template<typename T> constexpr T tm(); + template<typename T> static constexpr T ts(); }; void f(const S &s) { s.f(); s.g(); - int (*f)() = &S::Sf; + int (*Sf)() = &S::Sf; + int (S::*f)() const = &S::f; int (S::*g)() const = &S::g; + void *(*opNew)(size_t) = &S::operator new; + int (S::*tm)() const = &S::tm; + int (*ts)() = &S::ts; } +constexpr int S::f() const { return 0; } +constexpr int S::g() { return 1; } +constexpr int S::h() { return 0; } +int S::h() { return 0; } +constexpr int S::Sf() { return 2; } +constexpr void *S::operator new(size_t) noexcept { return 0; } +template<typename T> constexpr T S::tm() { return T(); } +template<typename T> constexpr T S::ts() { return T(); } + namespace std_example { class debug_flag { // expected-note {{not an aggregate and has no constexpr constructors}} |