Files
clang-p2996/clang/test/SemaCXX/invalid-if-constexpr.cpp
Mariya Podchishchaeva 9d9046f06d [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 https://github.com/llvm/llvm-project/issues/61885

Reviewed By: tbaeder, aaron.ballman

Differential Revision: https://reviews.llvm.org/D148206
2023-04-17 08:28:49 -04:00

15 lines
654 B
C++

// 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'?}}
}