comparison clang/test/SemaCXX/builtins.cpp @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 79ff65ed7e25
children 1f2b6ac9f198
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
2 // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++1z -fcxx-exceptions 2 // RUN: %clang_cc1 %s -fsyntax-only -verify -std=c++1z -fcxx-exceptions
3 typedef const struct __CFString * CFStringRef; 3 typedef const struct __CFString * CFStringRef;
4 #define CFSTR __builtin___CFStringMakeConstantString 4 #define CFSTR __builtin___CFStringMakeConstantString
5 5
6 void f() { 6 void f() {
7 #if !defined(__MVS__) && !defined(_AIX)
8 // Builtin function __builtin___CFStringMakeConstantString is currently
9 // unsupported on z/OS and AIX.
7 (void)CFStringRef(CFSTR("Hello")); 10 (void)CFStringRef(CFSTR("Hello"));
11 #endif
8 } 12 }
9 13
10 void a() { __builtin_va_list x, y; ::__builtin_va_copy(x, y); } 14 void a() { __builtin_va_list x, y; ::__builtin_va_copy(x, y); }
11 15
12 // <rdar://problem/10063539> 16 // <rdar://problem/10063539>
36 struct U { int n : 5; } u; 40 struct U { int n : 5; } u;
37 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}}
38 42
39 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}}
40 } 44 }
45
46 namespace function_start {
47 void a(void) {}
48 int n;
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}}
51 } // namespace function_start
41 52
42 void no_ms_builtins() { 53 void no_ms_builtins() {
43 __assume(1); // expected-error {{use of undeclared}} 54 __assume(1); // expected-error {{use of undeclared}}
44 __noop(1); // expected-error {{use of undeclared}} 55 __noop(1); // expected-error {{use of undeclared}}
45 __debugbreak(); // expected-error {{use of undeclared}} 56 __debugbreak(); // expected-error {{use of undeclared}}
131 struct Incomplete; // expected-note {{forward declaration}} 142 struct Incomplete; // expected-note {{forward declaration}}
132 struct IncompleteMember { 143 struct IncompleteMember {
133 Incomplete &i; 144 Incomplete &i;
134 }; 145 };
135 void test_incomplete(Incomplete *i, IncompleteMember *im) { 146 void test_incomplete(Incomplete *i, IncompleteMember *im) {
136 // expected-error@+1 {{incomplete type 'test_launder::Incomplete' where a complete type is required}} 147 // expected-error@+1 {{incomplete type 'Incomplete' where a complete type is required}}
137 __builtin_launder(i); 148 __builtin_launder(i);
138 __builtin_launder(&i); // OK 149 __builtin_launder(&i); // OK
139 __builtin_launder(im); // OK 150 __builtin_launder(im); // OK
140 } 151 }
141 152