Skip to content

Commit

Permalink
[Clang] Allow __is_nothrow_convertible to be used as an identifier (#…
Browse files Browse the repository at this point in the history
…80476)

`__is_nothrow_convertible` has been used by libstdc++ previously as an
identifier.
  • Loading branch information
philnik777 committed Feb 2, 2024
1 parent 9c2446e commit 05a6cb2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions clang/lib/Parse/ParseDeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1725,6 +1725,7 @@ void Parser::ParseClassSpecifier(tok::TokenKind TagTokKind,
tok::kw___is_member_pointer,
tok::kw___is_nothrow_assignable,
tok::kw___is_nothrow_constructible,
tok::kw___is_nothrow_convertible,
tok::kw___is_nothrow_destructible,
tok::kw___is_nullptr,
tok::kw___is_object,
Expand Down
14 changes: 14 additions & 0 deletions clang/test/SemaCXX/libstdcxx_is_nothrow_convertible_hack.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++20 -fms-extensions -Wno-microsoft %s
// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -verify -std=gnu++23 -fms-extensions -Wno-microsoft %s

template <class T, class U>
struct Same {
static constexpr auto value = __is_same(T, U);
};

template <class T>
struct __is_nothrow_convertible { // expected-warning{{keyword '__is_nothrow_convertible' will be made available as an identifier for the remainder of the translation unit}}
using type = T;
};

using A = Same<__is_nothrow_convertible<int>::type, __is_nothrow_convertible<int>::type>;

0 comments on commit 05a6cb2

Please sign in to comment.