1 // RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 2 // RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 3 // RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 4 // RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors 5 6 namespace std { struct type_info; } 7 8 namespace dr1902 { // dr1902: 3.7 9 struct A {}; 10 struct B { 11 B(A); 12 #if __cplusplus >= 201103L 13 // expected-note@-2 {{candidate}} 14 #endif 15 16 B() = delete; 17 #if __cplusplus < 201103L 18 // expected-error@-2 {{extension}} 19 #endif 20 21 B(const B&) // expected-note {{deleted here}} 22 #if __cplusplus >= 201103L 23 // expected-note@-2 {{candidate}} 24 #else 25 // expected-error@+2 {{extension}} 26 #endif 27 = delete; 28 29 operator A(); 30 }; 31 32 extern B b1; 33 B b2(b1); // expected-error {{call to deleted}} 34 35 #if __cplusplus >= 201103L 36 // This is ambiguous, even though calling the B(const B&) constructor would 37 // both directly and indirectly call a deleted function. 38 B b({}); // expected-error {{ambiguous}} 39 #endif 40 } 41 42 namespace dr1909 { // dr1909: yes 43 struct A { 44 template<typename T> struct A {}; // expected-error {{member 'A' has the same name as its class}} 45 }; 46 struct B { Bdr1909::B47 template<typename T> void B() {} // expected-error {{constructor cannot have a return type}} 48 }; 49 struct C { 50 template<typename T> static int C; // expected-error {{member 'C' has the same name as its class}} expected-error 0-1{{extension}} 51 }; 52 struct D { 53 template<typename T> using D = int; // expected-error {{member 'D' has the same name as its class}} expected-error 0-1{{extension}} 54 }; 55 } 56 57 #if __cplusplus >= 201103L 58 namespace dr1940 { // dr1940: yes 59 static union { 60 static_assert(true, ""); // ok 61 static_assert(false, ""); // expected-error {{static_assert failed}} 62 }; 63 } 64 #endif 65 66 #if __cplusplus >= 201402L 67 namespace dr1947 { // dr1947: yes 68 unsigned o = 0'01; // ok 69 unsigned b = 0b'01; // expected-error {{invalid digit 'b' in octal constant}} 70 unsigned x = 0x'01; // expected-error {{invalid suffix 'x'01' on integer constant}} 71 } 72 #endif 73 74 #if __cplusplus >= 201103L 75 // dr1948: yes 76 // FIXME: This diagnostic could be improved. 77 void *operator new(__SIZE_TYPE__) noexcept { return nullptr; } // expected-error{{exception specification in declaration does not match previous declaration}} 78 #endif 79 80 #if __cplusplus >= 201103L 81 namespace dr1968 { // dr1968: yes 82 static_assert(&typeid(int) == &typeid(int), ""); // expected-error{{not an integral constant expression}} 83 } 84 #endif 85 86 // dr1994: dup 529 87