• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 
3 template<typename T> using U = T;
4 
5 using I = U<U<U<U<int>>>>;
6 using I = int;
7 
8 template<typename A, typename B> using Fst = A;
9 template<typename A, typename B> using Snd = B;
10 
11 using I = Fst<Snd<char,int>,double>;
12 
13 namespace StdExample {
14   // Prerequisites for example.
15   template<class T, class A> struct vector { /* ... */ };
16 
17 
18   template<class T> struct Alloc {};
19   template<class T> using Vec = vector<T, Alloc<T>>;
20   Vec<int> v;
21 
22   template<class T>
process(Vec<T> & v)23     void process(Vec<T>& v) // expected-note {{previous definition is here}}
24     { /* ... */ }
25 
26   template<class T>
process(vector<T,Alloc<T>> & w)27     void process(vector<T, Alloc<T>>& w) // expected-error {{redefinition of 'process'}}
28     { /* ... */ }
29 
30   template<template<class> class TT>
31     void f(TT<int>); // expected-note {{candidate template ignored}}
32 
33   template<template<class,class> class TT>
34     void g(TT<int, Alloc<int>>);
35 
h()36   int h() {
37     f(v); // expected-error {{no matching function for call to 'f'}}
38     g(v); // OK: TT = vector
39   }
40 
41 
42   // v's type is same as vector<int, Alloc<int>>.
43   using VTest = vector<int, Alloc<int>>;
44   using VTest = decltype(v);
45 }
46