1 // RUN: %clang_cc1 -std=c++11 -verify %s -Wno-deprecated-builtins
3 namespace rdar12240916
{
10 struct S
{ // expected-note {{not complete}}
11 S x
; // expected-error {{incomplete type}}
20 struct S3
; // expected-note {{forward declaration}}
23 S3 x
; // expected-error {{incomplete type}}
39 namespace rdar12542261
{
44 static_assert(sizeof(_Tp
) > 0, "Type must be complete.");
49 class function
// expected-note 2 {{candidate}}
53 function(_Fp
, typename check_complete
<_Fp
>::type
* = 0); // expected-note {{candidate}}
58 auto LeftCanvas
= new Canvas(); // expected-error {{unknown type name}}
59 function
<void()> m_OnChange
= [&, LeftCanvas
]() { }; // expected-error {{no viable conversion}}
65 struct S
{}; // expected-note 3{{candidate}}
67 S
s(1, 2, 3); // expected-error {{no matching}}
69 // We used to attempt to evaluate the initializer of this variable,
70 // and crash because it has an undeduced type.
72 constexpr int k
= sizeof(x
);
77 namespace incorrect_auto_type_deduction_for_typo
{
79 template <typename T
> S(T t
) {
87 void test(int some_number
) { // expected-note {{'some_number' declared here}}
88 auto x
= sum_number
; // expected-error {{use of undeclared identifier 'sum_number'; did you mean 'some_number'?}}
95 struct X
{ X(const X
&x
); };
96 struct Y
: X
{ using X::X
; };
97 bool foo() { return __has_nothrow_constructor(Y
); }
98 bool bar() { return __has_nothrow_copy(Y
); }
100 struct A
{ template <typename T
> A(); };
101 struct B
: A
{ using A::A
; };
102 bool baz() { return __has_nothrow_constructor(B
); }
103 bool qux() { return __has_nothrow_copy(B
); }
106 namespace undeduced_field
{
114 // The missing expression makes A undeduced.
115 static constexpr auto A
= ; // expected-error {{expected expression}}
116 // expected-error@-1 {{declaration of variable 'A' with deduced type 'const auto' requires an initializer}}
118 Foo
<decltype(A
)>::type B
; // The type of B is also undeduced (wrapped in Elaborated).
121 // This used to crash when trying to get the layout of B.