xref: /llvm-project/clang/test/Frontend/verify-marker.c (revision 4e8144a0d140adf1ee07d78f3ff1ebb41790a9a3)
1 // RUN: %clang_cc1 -verify %s
2 
3 #include "verify-marker.h" // expected-error@#1 {{unknown type name 'unknown_type'}}
4 
5 int x = 1; // #a
6 int x = 2; // #b
7 // expected-error@#b {{redefinition of 'x'}}
8 // expected-note@#a {{previous}}
9 
10 // expected-error@#unknown {{}}  expected-error {{use of undefined marker '#unknown'}}
11 
12 // This is OK: there's no problem with a source file containing what looks like
13 // a duplicate definition of a marker if that marker is never used.
14 // #foo
15 // #foo
16 
17 // #bar  expected-note {{ambiguous marker '#bar' is defined here}}
18 // #bar  expected-note {{ambiguous marker '#bar' is defined here}}
19 // expected-error@#bar 0-1{{oops}}  expected-error{{reference to marker '#bar' is ambiguous}}
20 
21 // expected-error@#forward_ref {{undeclared identifier 'future'}}
22 int y = future; // #forward_ref
23