llvm-capstone/clang/test/SemaCXX/anonymous-union-export.cpp
Corentin Jabot a8bef8865e [Clang] Implement P2169 A nice placeholder with no name
This is a C++ feature that allows the use of `_` to
declare multiple variable of that name in the same scope;
these variables can then not be referred to.

In addition, while P2169 does not extend to parameter
declarations, we stop warning on unused parameters of that name,
for consistency.

The feature is backported to all C++ language modes.

Reviewed By: #clang-language-wg, aaron.ballman

Differential Revision: https://reviews.llvm.org/D153536
2023-08-04 16:51:15 +02:00

8 lines
445 B
C++

// RUN: %clang_cc1 -std=c++20 -emit-obj -verify -o %t.pcm %s
export module M;
export { // expected-note 2{{export block begins here}}
union { bool a; }; // expected-error {{anonymous unions at namespace or global scope must be declared 'static'}} expected-error {{declaration of 'a' with internal linkage cannot be exported}}
static union { bool b; }; // expected-error {{declaration of 'b' with internal linkage cannot be exported}}
}