Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / temp / temp.decls / temp.variadic / injected-class-name.cpp
blobc09c0b243a92f937bae5e7396fc28009d81740e0
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 // Check for declaration matching with out-of-line declarations and
5 // variadic templates, which involves proper computation of the
6 // injected-class-name.
7 template<typename T, typename ...Types>
8 struct X0 {
9 typedef T type;
11 void f0(T);
12 type f1(T);
15 template<typename T, typename ...Types>
16 void X0<T, Types...>::f0(T) { }
18 template<typename T, typename ...Types>
19 typename X0<T, Types...>::type X0<T, Types...>::f1(T) { }
21 template<typename T, typename ...Types>
22 struct X0<T, T, Types...> {
23 typedef T* result;
24 result f3();
26 template<typename... InnerTypes>
27 struct Inner;
30 template<typename T, typename ...Types>
31 typename X0<T, T, Types...>::result X0<T, T, Types...>::f3() { return 0; }
33 template<typename T, typename ...Types>
34 template<typename ...InnerTypes>
35 struct X0<T, T, Types...>::Inner {
36 template<typename ...ReallyInner> void f4();
39 template<typename T, typename ...Types>
40 template<typename ...InnerTypes>
41 template<typename ...ReallyInner>
42 void X0<T, T, Types...>::Inner<InnerTypes...>::f4() { }
44 namespace rdar8848837 {
45 // Out-of-line definitions that cause rebuilding in the current
46 // instantiation.
47 template<typename F> struct X;
49 template<typename R, typename ...ArgTypes>
50 struct X<R(ArgTypes...)> {
51 X<R(ArgTypes...)> f();
54 template<typename R, typename ...ArgTypes>
55 X<R(ArgTypes...)> X<R(ArgTypes...)>::f() { return *this; }
58 X<int(float, double)> xif;
60 template<unsigned> struct unsigned_c { };
61 template<typename ...ArgTypes> int g(ArgTypes...);
63 template<typename F> struct X1;
65 template<typename R, typename ...ArgTypes>
66 struct X1<R(ArgTypes...)> {
67 unsigned_c<sizeof(1 + g(ArgTypes()...))> f();
70 template<typename R, typename ...ArgTypes>
71 unsigned_c<sizeof(1 + g(ArgTypes()...))> X1<R(ArgTypes...)>::f() {
72 return unsigned_c<sizeof(int)>();
75 X1<int(float, double)> xif2;