aboutsummaryrefslogtreecommitdiff
path: root/clang/test/SemaTemplate/gh138371.cpp
blob: 1b8fe09eb7e97e48659c02295a7e2d7721a459e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// 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>();
}