You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[clang][Parser] Fix assertion failure for explicit(bool) in pre-C++20
Before this fix, using explicit(bool) syntax in C++98/C++03 modes
would cause an assertion failure in BuildConvertedConstantExpression due
to the parser accepting the syntax but semantic analysis rejecting it.
This patch:
- Adds a new diagnostic error 'err_explicit_bool_requires_cpp20'
- Updates parser logic to reject explicit(bool) in pre-C++17 modes with
proper error recovery instead of proceeding to semantic analysis
- Maintains existing behavior for C++17 (extension warning) and C++20+
for backward compatibility with existing code
The fix prevents crashes and provides clear error messages to users
attempting to use C++20 features in earlier language modes.
Fixes assertion: (S.getLangOpts().CPlusPlus11 || CCE == CCEKind::TempArgStrict)
in BuildConvertedConstantExpression
Test: clang/test/Parser/explicit-bool-pre-cxx17.cpp
0 commit comments