Mercurial > hg > CbC > CbC_llvm
comparison clang/test/SemaCXX/builtins.cpp @ 252:1f2b6ac9f198 llvm-original
LLVM16-1
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 18 Aug 2023 09:04:13 +0900 |
parents | c4bab56944e8 |
children |
comparison
equal
deleted
inserted
replaced
237:c80f45b162ad | 252:1f2b6ac9f198 |
---|---|
38 static_assert(&pt->n == &t.n, ""); | 38 static_assert(&pt->n == &t.n, ""); |
39 | 39 |
40 struct U { int n : 5; } u; | 40 struct U { int n : 5; } u; |
41 int *pbf = __builtin_addressof(u.n); // expected-error {{address of bit-field requested}} | 41 int *pbf = __builtin_addressof(u.n); // expected-error {{address of bit-field requested}} |
42 | 42 |
43 S *ptmp = __builtin_addressof(S{}); // expected-error {{taking the address of a temporary}} | 43 S *ptmp = __builtin_addressof(S{}); // expected-error {{taking the address of a temporary}} expected-warning {{temporary whose address is used as value of local variable 'ptmp' will be destroyed at the end of the full-expression}} |
44 } | 44 } |
45 | 45 |
46 namespace function_start { | 46 namespace function_start { |
47 void a(void) {} | 47 void a(void) {} |
48 int n; | 48 int n; |
49 void *p = __builtin_function_start(n); // expected-error {{argument must be a function}} | 49 void *p = __builtin_function_start(n); // expected-error {{argument must be a function}} |
50 static_assert(__builtin_function_start(a) == a, ""); // expected-error {{static assertion expression is not an integral constant expression}} | 50 static_assert(__builtin_function_start(a) == a, ""); // expected-error {{static assertion expression is not an integral constant expression}} |
51 // expected-note@-1 {{comparison of addresses of literals has unspecified value}} | |
51 } // namespace function_start | 52 } // namespace function_start |
52 | 53 |
53 void no_ms_builtins() { | 54 void no_ms_builtins() { |
54 __assume(1); // expected-error {{use of undeclared}} | 55 __assume(1); // expected-error {{use of undeclared}} |
55 __noop(1); // expected-error {{use of undeclared}} | 56 __noop(1); // expected-error {{use of undeclared}} |
162 (void)__builtin_complex(v, v); // expected-error {{not a real floating}} | 163 (void)__builtin_complex(v, v); // expected-error {{not a real floating}} |
163 } | 164 } |
164 template void test_builtin_complex(double, double); | 165 template void test_builtin_complex(double, double); |
165 template void test_builtin_complex(float, double); // expected-note {{instantiation of}} | 166 template void test_builtin_complex(float, double); // expected-note {{instantiation of}} |
166 template void test_builtin_complex(int, double); // expected-note {{instantiation of}} | 167 template void test_builtin_complex(int, double); // expected-note {{instantiation of}} |
168 | |
169 #ifdef __x86_64__ | |
170 // This previously would cause an assertion when emitting the note diagnostic. | |
171 static void __builtin_cpu_init(); // expected-error {{static declaration of '__builtin_cpu_init' follows non-static declaration}} \ | |
172 expected-note {{'__builtin_cpu_init' is a builtin with type 'void () noexcept'}} | |
173 #endif |