1 // REQUIRES: x86-registered-target
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -verify=expected,enabled -emit-codegen-only %s
3 // RUN: %clang_cc1 -verify -triple x86_64-linux-gnu -emit-codegen-only -Wno-attribute-warning %s
5 __attribute__((error("oh no foo"))) void foo(void);
7 __attribute__((error("oh no bar"))) void bar(void);
13 __attribute__((warning("oh no quux"))) void quux(void);
15 __attribute__((error("demangle me"))) void __compiletime_assert_455(void);
17 __attribute__((error("one"), error("two"))) // expected-warning {{attribute 'error' is already applied with different arguments}}
18 void // expected-note@-1 {{previous attribute is here}}
19 duplicate_errors(void);
21 __attribute__((warning("one"), warning("two"))) // expected-warning {{attribute 'warning' is already applied with different arguments}}
22 void // expected-note@-1 {{previous attribute is here}}
23 duplicate_warnings(void);
26 foo(); // expected-error {{call to 'foo()' declared with 'error' attribute: oh no foo}}
28 bar(); // expected-error {{call to 'bar()' declared with 'error' attribute: oh no bar}}
30 quux(); // enabled-warning {{call to 'quux()' declared with 'warning' attribute: oh no quux}}
31 __compiletime_assert_455(); // expected-error {{call to '__compiletime_assert_455()' declared with 'error' attribute: demangle me}}
32 duplicate_errors(); // expected-error {{call to 'duplicate_errors()' declared with 'error' attribute: two}}
33 duplicate_warnings(); // enabled-warning {{call to 'duplicate_warnings()' declared with 'warning' attribute: two}}
38 __attribute__((error("demangle me, too")))
43 __attribute__((warning("don't call me!")))
44 operator int() { return 42; }
48 foo(); // expected-error {{call to 'foo()' declared with 'error' attribute: oh no foo}}
50 bar(); // expected-error {{call to 'bar()' declared with 'error' attribute: oh no bar}}
51 quux(); // enabled-warning {{call to 'quux()' declared with 'warning' attribute: oh no quux}}
53 // Test that we demangle correctly in the diagnostic for C++.
54 __compiletime_assert_455(); // expected-error {{call to '__compiletime_assert_455()' declared with 'error' attribute: demangle me}}
55 nocall
<int>(42); // expected-error {{call to 'int nocall<int>(int)' declared with 'error' attribute: demangle me, too}}
58 int w
= W
; // enabled-warning {{call to 'Widget::operator int()' declared with 'warning' attribute: don't call me!}}