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 dr1715
{ // dr1715: 3.9
7 #if __cplusplus >= 201103L
9 template<class T
> B(T
, typename
T::Q
);
14 template<class T
> friend B::B(T
, typename
T::Q
);
20 struct E
: B
{ // expected-note 2{{candidate}}
21 template<class T
> E(T t
, typename
T::Q q
) : B(t
, q
) {} // expected-note {{'Q' is a private member}}
26 E
e(S(), 3); // expected-error {{no match}}
30 namespace dr1722
{ // dr1722: 9
31 #if __cplusplus >= 201103L
33 const auto lambda
= [](int x
) { return x
+ 1; };
34 // Without the DR applied, this static_assert would fail.
36 noexcept((int (*)(int))(lambda
)),
37 "Lambda-to-function-pointer conversion is expected to be noexcept");
42 namespace dr1734
{ // dr1734: no
43 #if __cplusplus >= 201103L
47 // FIXME: 'A' should not be trivially copyable because the class lacks at least
48 // one non-deleted copy constructor, move constructor, copy assignment
49 // operator, or move assignment operator.
50 static_assert(__is_trivially_copyable(A
), "");
54 namespace dr1736
{ // dr1736: 3.9
55 #if __cplusplus >= 201103L
57 template <class T
> S(T t
) {
61 typename
T::type value
; // expected-error {{no member}}
62 L
l(value
); // expected-note {{instantiation of}}
65 struct Q
{ typedef int type
; } q
;
66 S
s(q
); // expected-note {{instantiation of}}
70 namespace dr1753
{ // dr1753: 11
72 struct A
{ typedef int T
; };
73 namespace B
{ typedef int T
; }
79 n
.dr1753::~T(); // expected-error {{'dr1753' does not refer to a type name in pseudo-destructor}}
82 n
.A::~T(); // expected-error {{the type of object expression ('T' (aka 'int')) does not match the type being destroyed ('A') in pseudo-destructor expression}}
85 n
.B::~T(); // expected-error {{'B' does not refer to a type name in pseudo-destructor expression}}
88 #if __cplusplus >= 201103L
89 n
.decltype(n
)::~T(); // expected-error {{not a class, namespace, or enumeration}}
90 n
.T::~decltype(n
)(); // expected-error {{expected a class name after '~'}}
91 n
.~decltype(n
)(); // OK
96 namespace dr1756
{ // dr1756: 3.7
97 #if __cplusplus >= 201103L
98 // Direct-list-initialization of a non-class object
102 struct X
{ operator int(); } x
;
107 namespace dr1758
{ // dr1758: 3.7
108 #if __cplusplus >= 201103L
109 // Explicit conversion in copy/move list initialization
112 struct Y
{ explicit operator X(); } y
;
120 operator A() { return A(); }
126 namespace dr1762
{ // dr1762: 14
127 #if __cplusplus >= 201103L
128 float operator ""_E(const char *);
129 // expected-error@+2 {{invalid suffix on literal; C++11 requires a space between literal and identifier}}
130 // expected-warning@+1 {{user-defined literal suffixes not starting with '_' are reserved; no literal will invoke this operator}}
131 float operator ""E(const char *);
135 namespace dr1778
{ // dr1778: 9
136 // Superseded by P1286R2.
137 #if __cplusplus >= 201103L
138 struct A
{ A() noexcept(true) = default; };
139 struct B
{ B() noexcept(false) = default; };
140 static_assert(noexcept(A()), "");
141 static_assert(!noexcept(B()), "");
143 struct C
{ A a
; C() noexcept(false) = default; };
144 struct D
{ B b
; D() noexcept(true) = default; };
145 static_assert(!noexcept(C()), "");
146 static_assert(noexcept(D()), "");