[clang] [Clang] Fix parsing of reversible type traits in template arguments (PR #95969)
Richard Smith via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 18 13:07:32 PDT 2024
================
@@ -141,3 +141,15 @@ namespace r360308_regression {
return a == b;
}
}
+
+namespace GH95598 {
+template<typename _Tp, bool _IsPtr = __is_pointer(_Tp)>
+struct __is_pointer {};
+// expected-warning at -1 {{keyword '__is_pointer' will be made available as an identifier for the remainder of the translation unit}}
----------------
zygoloid wrote:
One thing we could consider doing would be removing the entire "revertible keyword" mechanism, and instead, in the lexer, classifying these tokens as keywords only if the next pp-token is an `lparen`. That would probably simplify the handling of these keywords everywhere, and would happen to give the outcome that libstdc++ is expecting in this case too. (It's a breaking change for some weird corner cases, such as producing the keyword via macro expansion and things like `bool __is_pointer(true);`, but hopefully those things don't happen in practice!)
https://github.com/llvm/llvm-project/pull/95969
More information about the cfe-commits
mailing list