blob: 2a21f727df75212979d620083a088737f2930f75 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Douglas Gregor17343172009-04-01 00:28:59 +00002
3template<typename MetaFun, typename T>
4struct bind_metafun {
5 typedef typename MetaFun::template apply<T> type;
6};
7
8struct add_pointer {
9 template<typename T>
10 struct apply {
11 typedef T* type;
12 };
13};
14
15int i;
16// FIXME: if we make the declarator below a pointer (e.g., with *ip),
17// the error message isn't so good because we don't get the handy
18// 'aka' telling us that we're dealing with an int**. Should we fix
19// getDesugaredType to dig through pointers and such?
20bind_metafun<add_pointer, int>::type::type ip = &i;
Douglas Gregord249e1d1f2009-05-29 20:38:28 +000021bind_metafun<add_pointer, float>::type::type fp = &i; // expected-error{{incompatible type initializing 'int *', expected 'bind_metafun<add_pointer, float>::type::type' (aka 'float *')}}
Douglas Gregor17343172009-04-01 00:28:59 +000022
23
24template<typename T>
25struct extract_type_type {
26 typedef typename T::type::type t;
27};
28
29double d;
30extract_type_type<bind_metafun<add_pointer, double> >::t dp = &d;