1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-c++11-extensions %s
3 namespace fizbin
{ class Foobar
{}; } // expected-note 2 {{'fizbin::Foobar' declared here}} \
4 // expected-note {{'Foobar' declared here}}
5 Foobar
*my_bar
// expected-error{{unknown type name 'Foobar'; did you mean 'fizbin::Foobar'?}}
6 = new Foobar
; // expected-error{{unknown type name 'Foobar'; did you mean 'fizbin::Foobar'?}}
7 fizbin::Foobar
*my_foo
= new fizbin::FooBar
; // expected-error{{no type named 'FooBar' in namespace 'fizbin'; did you mean 'Foobar'?}}
9 namespace barstool
{ int toFoobar() { return 1; } } // expected-note 3 {{'barstool::toFoobar' declared here}}
10 int Double(int x
) { return x
+ x
; }
12 Double(toFoobar()); // expected-error{{use of undeclared identifier 'toFoobar'; did you mean 'barstool::toFoobar'?}}
16 namespace baztool
{ bool toFoobar() { return true; } } // expected-note{{'fizbin::baztool' declared here}}
17 namespace nested
{ bool moreFoobar() { return true; } } // expected-note{{'fizbin::nested::moreFoobar' declared here}}
18 namespace nested
{ bool lessFoobar() { return true; } } // expected-note{{'fizbin::nested' declared here}} \
19 // expected-note{{'fizbin::nested::lessFoobar' declared here}}
20 class dummy
{ // expected-note 2 {{'fizbin::dummy' declared here}}
22 static bool morebar() { return false; } // expected-note{{'morebar' declared here}}
25 void Check() { // expected-note{{'Check' declared here}}
26 if (toFoobar()) Double(7); // expected-error{{use of undeclared identifier 'toFoobar'; did you mean 'barstool::toFoobar'?}}
27 if (noFoobar()) Double(7); // expected-error{{use of undeclared identifier 'noFoobar'; did you mean 'barstool::toFoobar'?}}
28 if (moreFoobar()) Double(7); // expected-error{{use of undeclared identifier 'moreFoobar'; did you mean 'fizbin::nested::moreFoobar'}}
29 if (lessFoobar()) Double(7); // expected-error{{use of undeclared identifier 'lessFoobar'; did you mean 'fizbin::nested::lessFoobar'?}}
30 if (baztool::toFoobar()) Double(7); // expected-error{{use of undeclared identifier 'baztool'; did you mean 'fizbin::baztool'?}}
31 if (nested::moreFoobar()) Double(7); // expected-error{{use of undeclared identifier 'nested'; did you mean 'fizbin::nested'?}}
32 if (dummy::morebar()) Double(7); // expected-error{{use of undeclared identifier 'dummy'; did you mean 'fizbin::dummy'?}}
33 if (dummy::mrebar()) Double(7); // expected-error{{use of undeclared identifier 'dummy'; did you mean 'fizbin::dummy'?}} \
34 // expected-error{{no member named 'mrebar' in 'fizbin::dummy'; did you mean 'morebar'?}}
35 if (moFoobin()) Double(7); // expected-error{{use of undeclared identifier 'moFoobin'}}
39 Cleck(); // expected-error{{use of undeclared identifier 'Cleck'; did you mean 'Check'?}}
44 class myvector
{ /* ... */ }; // expected-note{{'inner::myvector' declared here}}
48 myvector v
; // expected-error{{unknown type name 'myvector'; did you mean 'inner::myvector'?}}
53 inline namespace __1
{
54 class mylinkedlist
{ /* ... */ }; // expected-note 2 {{'realstd::mylinkedlist' declared here}}
57 class linkedlist
{ /* ... */ };
61 mylinkedlist v
; // expected-error{{unknown type name 'mylinkedlist'; did you mean 'realstd::mylinkedlist'?}}
62 nylinkedlist w
; // expected-error{{unknown type name 'nylinkedlist'; did you mean 'realstd::mylinkedlist'?}}
65 // Test case from http://llvm.org/bugs/show_bug.cgi?id=10318
67 template <typename T
> class GraphWriter
{}; // expected-note 3{{declared here}}
72 GraphWriter
<S
> x
; //expected-error{{no template named 'GraphWriter'; did you mean 'llvm::GraphWriter'?}}
73 (void)new llvm::GraphWriter
; // expected-error {{use of class template 'llvm::GraphWriter' requires template arguments}}
74 (void)new llvm::Graphwriter
<S
>; // expected-error {{no template named 'Graphwriter' in namespace 'llvm'; did you mean 'GraphWriter'?}}
77 // If namespace prefixes and character edits have the same weight, correcting
78 // "fimish" to "N::famish" would have the same edit distance as correcting
79 // "fimish" to "Finish". The result would be no correction being suggested
80 // unless one of the corrections is given precedence (e.g. by filtering out
81 // suggestions with added namespace qualifiers).
82 namespace N
{ void famish(int); }
83 void Finish(int); // expected-note {{'Finish' declared here}}
85 fimish(7); // expected-error {{use of undeclared identifier 'fimish'; did you mean 'Finish'?}}
88 // But just eliminating the corrections containing added namespace qualifiers
89 // won't work if both of the tied corrections have namespace qualifiers added.
91 void someCheck(int); // expected-note {{'N::someCheck' declared here}}
92 namespace O
{ void somechock(int); }
95 somechick(7); // expected-error {{use of undeclared identifier 'somechick'; did you mean 'N::someCheck'?}}
102 namespace MessageUtils
{
103 bool Equivalent(const Message
&, const Message
&); // expected-note {{'extra::util::MessageUtils::Equivalent' declared here}} \
104 // expected-note {{'::extra::util::MessageUtils::Equivalent' declared here}}
108 namespace util
{ namespace MessageUtils
{} }
111 return util::MessageUtils::Equivalent(a
, b
); // expected-error {{no member named 'Equivalent' in namespace 'util::MessageUtils'; did you mean 'extra::util::MessageUtils::Equivalent'?}}
118 return MessageUtils::Equivalent(a
, b
); // expected-error {{no member named 'Equivalent' in namespace 'util::MessageUtils'; did you mean '::extra::util::MessageUtils::Equivalent'?}}