comparison clang/test/PCH/non-trivial-c-union.m @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children
comparison
equal deleted inserted replaced
147:c2174574ed3a 150:1d019706d866
1 // RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -emit-pch -o %t.pch %s
2 // RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -include-pch %t.pch -verify %s
3
4 #ifndef HEADER
5 #define HEADER
6
7 typedef union {
8 id f0;
9 } U0;
10
11 #else
12
13 // expected-note@-6 {{'U0' has subobjects that are non-trivial to destruct}}
14 // expected-note@-7 {{'U0' has subobjects that are non-trivial to copy}}
15 // expected-note@-8 {{'U0' has subobjects that are non-trivial to default-initialize}}
16 // expected-note@-8 {{f0 has type '__strong id' that is non-trivial to destruct}}
17 // expected-note@-9 {{f0 has type '__strong id' that is non-trivial to copy}}
18 // expected-note@-10 {{f0 has type '__strong id' that is non-trivial to default-initialize}}
19
20 U0 foo0(void); // expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to destruct}} expected-error {{cannot use type 'U0' for function/method return since it is a union that is non-trivial to copy}}
21
22 U0 g0; // expected-error {{cannot default-initialize an object of type 'U0' since it is a union that is non-trivial to default-initialize}}
23
24 #endif