1 // RUN: %clang_cc1 -fsyntax-only -std=c++17 -verify %s
4 return s
; // expected-error {{use of undeclared identifier 's'}}
7 int test
= 11; // expected-note 2 {{'test' declared here}}
10 return tes
; // expected-error {{use of undeclared identifier 'tes'; did you mean 'test'?}}
11 // expected-error@-1 {{deduced as 'int' here but deduced as 'const char *' in earlier}}
14 template <class A
, class B
> struct is_same
{ static constexpr bool value
= false; };
15 template <class A
> struct is_same
<A
,A
> { static constexpr bool value
= true; };
17 auto L1
= [] { return s
; }; // expected-error {{use of undeclared identifier 's'}}
18 using T1
= decltype(L1());
19 // FIXME: Suppress the 'undeclared identifier T1' diagnostic, the UsingDecl T1 is discarded because of an invalid L1().
20 static_assert(is_same
<T1
, void>::value
, "Return statement should be discarded"); // expected-error {{use of undeclared identifier 'T1'}}
21 auto L2
= [] { return tes
; }; // expected-error {{use of undeclared identifier 'tes'; did you mean 'test'?}}
22 using T2
= decltype(L2());
23 static_assert(is_same
<T2
, int>::value
, "Return statement was corrected");
25 namespace BarNamespace
{
26 namespace NestedNamespace
{ // expected-note {{'BarNamespace::NestedNamespace' declared here}}
31 FooRecord::NestedNamespace::type x
; // expected-error {{no member named 'NestedNamespace' in 'FooRecord'; did you mean 'BarNamespace::NestedNamespace'?}}
33 void cast_expr(int g
) { +int(n
)(g
); } // expected-error {{undeclared identifier 'n'}}
35 void bind() { for (const auto& [test
,_
] : _test_
) { }; } // expected-error {{undeclared identifier '_test_'}}
39 void Function(int a
) {
40 unknown1(unknown2
, Function
, unknown3
); // expected-error 2{{use of undeclared identifier}} \
41 expected
-error
{{reference to non
-static member function must be called
}}
46 namespace NoCrashOnCheckArgAlignment
{
47 template <typename a
> void b(a
&);
49 for (auto file_data
:b(files_db_data
)); // expected-error {{use of undeclared identifier 'files_db_data'; did you mean 'file_data'?}} \
50 // expected-note {{'file_data' declared here}} \
51 // expected-error {{cannot use type 'void' as a range}}