Skip to content

Commit cff9e77

Browse files
authored
[Clang][NFC] Mark P2552 as implemented. (#92007)
wg21.link/P2552 suggest that __has_cpp_attribute should return a non-zero value for all attributes that the implementation does something interesting with. Clang does something meaninful with all attributes except for: - no_unique_address which we do not support for msvc target - carries_dependency which arguably does nothing interesting. P2552 shies away from specifying a behavior for that attribute (despite being the only one for which a recommandation would have been interesting, arguably) As such, we have nothing to change for this paper. This paper is a DR and clang always behaved reasonably.
1 parent cf8b93d commit cff9e77

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple x86_64-pc-linux -fsyntax-only -verify -Wno-c++17-extensions
2+
// RUN: %clang_cc1 %s -x c++ -std=c++11 -triple x86_64-windows-msvc -fsyntax-only -verify=msvc -Wno-c++17-extensions
3+
// expected-no-diagnostics
4+
5+
// Check we return non-zero values for supported attributes as per
6+
// wg21.link/P2552
7+
static_assert(__has_cpp_attribute(assume));
8+
9+
// The standard does not prescribe a behavior for [[carries_dependency]]
10+
11+
static_assert(__has_cpp_attribute(deprecated));
12+
static_assert(__has_cpp_attribute(fallthrough));
13+
static_assert(__has_cpp_attribute(likely));
14+
static_assert(__has_cpp_attribute(unlikely));
15+
static_assert(__has_cpp_attribute(maybe_unused));
16+
static_assert(__has_cpp_attribute(nodiscard));
17+
static_assert(__has_cpp_attribute(noreturn));
18+
19+
// We do not support [[no_unique_address]] in MSVC emulation mode
20+
static_assert(__has_cpp_attribute(no_unique_address)); // msvc-error {{static assertion failed}}

clang/www/cxx_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ <h2 id="cxx26">C++2c implementation status</h2>
130130
<tr>
131131
<td>On the ignorability of standard attributes</td>
132132
<td><a href="https://wg21.link/P2552R3">P2552R3</a> (<a href="#dr">DR</a>)</td>
133-
<td class="none" align="center">No</td>
133+
<td class="full" align="center">Yes</td>
134134
</tr>
135135
<tr>
136136
<td>Static storage for braced initializers</td>

0 commit comments

Comments
 (0)