blob: 3a537d424ba0c0f4e0abcd3729892afa02e3188b [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Daniel Dunbar032db472008-07-31 22:40:48 +00002
John McCall4bb48362011-01-25 03:51:08 +00003int x __attribute__((constructor)); // expected-warning {{'constructor' attribute only applies to functions}}
Daniel Dunbar032db472008-07-31 22:40:48 +00004int f() __attribute__((constructor));
5int f() __attribute__((constructor(1)));
Aaron Ballman05e420a2014-01-02 21:26:14 +00006int f() __attribute__((constructor(1,2))); // expected-error {{'constructor' attribute takes no more than 1 argument}}
Aaron Ballmanf22ef5a2013-11-21 01:50:40 +00007int f() __attribute__((constructor(1.0))); // expected-error {{'constructor' attribute requires an integer constant}}
Aaron Ballman31f42312014-07-24 14:51:23 +00008int f() __attribute__((constructor(0x100000000))); // expected-error {{integer constant expression evaluates to value 4294967296 that cannot be represented in a 32-bit unsigned integer type}}
Daniel Dunbar032db472008-07-31 22:40:48 +00009
John McCall4bb48362011-01-25 03:51:08 +000010int x __attribute__((destructor)); // expected-warning {{'destructor' attribute only applies to functions}}
Daniel Dunbar032db472008-07-31 22:40:48 +000011int f() __attribute__((destructor));
12int f() __attribute__((destructor(1)));
Aaron Ballman05e420a2014-01-02 21:26:14 +000013int f() __attribute__((destructor(1,2))); // expected-error {{'destructor' attribute takes no more than 1 argument}}
Aaron Ballmanf22ef5a2013-11-21 01:50:40 +000014int f() __attribute__((destructor(1.0))); // expected-error {{'destructor' attribute requires an integer constant}}
Daniel Dunbar032db472008-07-31 22:40:48 +000015
16