llvm-project/clang/test/SemaCXX/warn-once-on-unknown-attr.cpp
Jun Zhang f9c2f821d7
[Clang] Fix unknown type attributes diagnosed twice with [[]] spelling
Don't warn on unknown type attributes in Parser::ProhibitCXX11Attributes
for most cases, but left the diagnostic to the later checks.
module declaration and module import declaration are special cases.

Fixes https://github.com/llvm/llvm-project/issues/54817

Differential Revision: https://reviews.llvm.org/D123447
2022-04-12 21:11:51 +08:00

12 lines
468 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
// RUN: %clang_cc1 -fsyntax-only -verify -std=c2x -x c %s
void foo() {
int [[attr]] i; // expected-warning {{unknown attribute 'attr' ignored}}
(void)sizeof(int [[attr]]); // expected-warning {{unknown attribute 'attr' ignored}}
}
void bar() {
[[attr]]; // expected-warning {{unknown attribute 'attr' ignored}}
[[attr]] int i; // expected-warning {{unknown attribute 'attr' ignored}}
}