You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// RUN: %clang_cc1 -x c -fsyntax-only -verify -Wno-strict-prototypes %s
2
3
3
4
int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}}
4
5
intf(void) __attribute__((constructor));
5
6
intf(void) __attribute__((constructor(1)));
6
7
intf(void) __attribute__((constructor(1,2))); // expected-error {{'constructor' attribute takes no more than 1 argument}}
7
8
intf(void) __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires an integer constant}}
8
9
intf(void) __attribute__((constructor(0x100000000))); // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
[[gnu::constructor(P)]] voidf(); // expected-error {{'gnu::constructor' attribute requires an integer constant}}
15
+
16
+
template <longlong P>
17
+
[[gnu::constructor(P)]] voidf() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
18
+
template void f<1LL<<32>(); // expected-note {{in instantiation of function template specialization 'f<4294967296LL>' requested here}}
[[gnu::constructor(static_cast<T>(1LL<<32))]] voidh() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
32
+
template void h<longlong>(); // expected-note {{in instantiation of function template specialization 'h<long long>' requested here}}
33
+
#endif
10
34
11
35
int y __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to functions}}
12
36
intf(void) __attribute__((destructor));
13
37
intf(void) __attribute__((destructor(1)));
14
38
intf(void) __attribute__((destructor(1,2))); // expected-error {{'destructor' attribute takes no more than 1 argument}}
15
39
intf(void) __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires an integer constant}}
[[gnu::destructor(I)]] voidf(); // expected-error {{'gnu::destructor' attribute requires an integer constant}}
44
+
45
+
template <longlong P>
46
+
[[gnu::destructor(P)]] voidfd() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
47
+
template void fd<1LL<<32>(); // expected-note {{in instantiation of function template specialization 'fd<4294967296LL>' requested here}}
[[gnu::destructor(static_cast<T>(1LL<<32))]] voidhd() {} // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
61
+
template void hd<longlong>(); // expected-note {{in instantiation of function template specialization 'hd<long long>' requested here}}
0 commit comments