Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / equivalence.cpp
blob24cd4054ac37631da74db4412131f133c6f8c0f3
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
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}}
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}}
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}}