Debian Codegraph @

clang/test/SemaTemplate/gh138371.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3
4 // This would previously trigger a failed assertion when instantiating the
5 // template which uses an overloaded call operator because the end location
6 // for the expression came from a macro expansion.
7
8 #define ASSIGN_OR_RETURN(...) (__VA_ARGS__)
9
10 struct Loc {
11 int operator()(const char* _Nonnull f = __builtin_FILE()) const;
12 };
13
14 template <typename Ty>
15 void f() {
16 ASSIGN_OR_RETURN(Loc()());
17 }
18
19 void test() {
20 f<int>();
21 }
22