Debian Codegraph @

clang/test/SemaTemplate/equivalence.cpp

raw
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
3 // Ensure we undo the rewrite from `a++` to a binary `a ++ 0` before profiling.
4 namespace PostIncDec {
5 // Increment / decrement as UnaryOperator.
6 template<typename T> auto inc(T &a) -> decltype(a++) {} // expected-note {{previous}}
7 template<typename T> auto dec(T &a) -> decltype(a--) {} // expected-note {{previous}}
8
9 struct X {};
10 void operator++(X&, int);
11 void operator--(X&, int);
12 // Increment / decrement as CXXOverloadedCallExpr. These are redefinitions.
13 template<typename T> auto inc(T &a) -> decltype(a++) {} // expected-error {{redefinition}} expected-note {{candidate}}
14 template<typename T> auto dec(T &a) -> decltype(a--) {} // expected-error {{redefinition}} expected-note {{candidate}}
15
16 // These are not ambiguous calls.
17 void f(X x) {
18 // FIXME: Don't produce these follow-on errors.
19 inc(x); // expected-error {{no match}}
20 dec(x); // expected-error {{no match}}
21 }
22 }