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
6 namespace std { struct type_info; }
8 namespace dr1902 { // dr1902: 3.7
12 #if __cplusplus >= 201103L
13 // expected-note@-2 {{candidate}}
17 #if __cplusplus < 201103L
18 // expected-error@-2 {{extension}}
21 B(const B&) // expected-note {{deleted here}}
22 #if __cplusplus >= 201103L
23 // expected-note@-2 {{candidate}}
25 // expected-error@+2 {{extension}}
33 B b2(b1); // expected-error {{call to deleted}}
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}}
42 namespace dr1909 { // dr1909: yes
44 template<typename T> struct A {}; // expected-error {{member 'A' has the same name as its class}}
47 template<typename T> void B() {} // expected-error {{constructor cannot have a return type}}
50 template<typename T> static int C; // expected-error {{member 'C' has the same name as its class}} expected-error 0-1{{extension}}
53 template<typename T> using D = int; // expected-error {{member 'D' has the same name as its class}} expected-error 0-1{{extension}}
57 #if __cplusplus >= 201103L
58 namespace dr1940 { // dr1940: yes
60 static_assert(true, ""); // ok
61 static_assert(false, ""); // expected-error {{static_assert failed}}
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}}
74 #if __cplusplus >= 201103L
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}}
80 #if __cplusplus >= 201103L
81 namespace dr1968 { // dr1968: yes
82 static_assert(&typeid(int) == &typeid(int), ""); // expected-error{{not an integral constant expression}}