brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · a5b39fe Raw
46 lines · cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s2 3template<typename T> using U = T;4 5using I = U<U<U<U<int>>>>;6using I = int;7 8template<typename A, typename B> using Fst = A;9template<typename A, typename B> using Snd = B;10 11using I = Fst<Snd<char,int>,double>;12 13namespace 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>23    void process(Vec<T>& v) // expected-note {{previous definition is here}}24    { /* ... */ }25 26  template<class T>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 36  int h() {37    f(v); // expected-error {{no matching function for call to 'f'}}38    g(v); // OK: TT = vector39  }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