xref: /llvm-project/clang/test/Sema/attr-nomerge.cpp (revision 06eee734c1ea9de754c1e7e8c79c0897b9e01350)
1 // RUN: %clang_cc1 -verify -fsyntax-only %s
2 
3 void bar();
4 
foo()5 void foo() {
6   [[clang::nomerge]] bar();
7   [[clang::nomerge(1, 2)]] bar(); // expected-error {{'nomerge' attribute takes no arguments}}
8   int x;
9   [[clang::nomerge]] x = 10; // expected-warning {{'nomerge' attribute is ignored because there exists no call expression inside the statement}}
10 
11   [[clang::nomerge]] label: bar(); // expected-error {{'nomerge' attribute only applies to functions, statements and variables}}
12 
13 }
14 
15 [[clang::nomerge]] int f();
16 
17 [[clang::nomerge]] static int i = f(); // expected-warning {{'nomerge' attribute is ignored because 'i' is not a function pointer}}
18 
19 [[clang::nomerge]] void (*j)(void);
20 
21 struct [[clang::nomerge]] buz {}; // expected-error {{'nomerge' attribute only applies to functions, statements and variables}}
22