Aaron Ballman 6260d8ff82
[C++] Fix a failed assertion with nullability checking (#148881)
This fixes a failed assertion with an operator call expression which
comes from a macro expansion when performing analysis for nullability
attributes.

Fixes #138371
2025-07-15 13:06:45 -04:00

23 lines
500 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
// This would previously trigger a failed assertion when instantiating the
// template which uses an overloaded call operator because the end location
// for the expression came from a macro expansion.
#define ASSIGN_OR_RETURN(...) (__VA_ARGS__)
struct Loc {
int operator()(const char* _Nonnull f = __builtin_FILE()) const;
};
template <typename Ty>
void f() {
ASSIGN_OR_RETURN(Loc()());
}
void test() {
f<int>();
}