-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang] Do not crash after suggesting typo correction to constexpr if…
… condition In some cases non-null non-constant yet valid expression may reach point where `ConditionResult` is created. For example, typo correction mechanism can return such expression, so double check before evaluating it. Fixes #61885 Reviewed By: tbaeder, aaron.ballman Differential Revision: https://reviews.llvm.org/D148206
- Loading branch information
Showing
3 changed files
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// RUN: %clang_cc1 -verify -std=c++20 %s | ||
|
||
namespace GH61885 { | ||
void similar() { // expected-note {{'similar' declared here}} | ||
if constexpr (similer<>) {} // expected-error {{use of undeclared identifier 'similer'; did you mean 'similar'?}} | ||
} | ||
void a() { if constexpr (__adl_swap<>) {}} // expected-error{{use of undeclared identifier '__adl_swap'; did you mean '__sync_swap'?}} \ | ||
// expected-note {{'__sync_swap' declared here}} | ||
|
||
int AA() { return true;} // expected-note {{'AA' declared here}} | ||
|
||
void b() { if constexpr (AAA<>) {}} // expected-error {{use of undeclared identifier 'AAA'; did you mean 'AA'?}} | ||
} | ||
|