Douglas Gregor | de650ae | 2009-03-31 18:38:02 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | |
| 3 | template<template<typename T> class MetaFun, typename Value> |
| 4 | struct apply { |
| 5 | typedef typename MetaFun<Value>::type type; |
| 6 | }; |
| 7 | |
| 8 | template<class T> |
| 9 | struct add_pointer { |
| 10 | typedef T* type; |
| 11 | }; |
| 12 | |
| 13 | template<class T> |
| 14 | struct add_reference { |
| 15 | typedef T& type; |
| 16 | }; |
| 17 | |
| 18 | int i; |
| 19 | apply<add_pointer, int>::type ip = &i; |
| 20 | apply<add_reference, int>::type ir = i; |
| 21 | apply<add_reference, float>::type fr = i; // expected-error{{non-const lvalue reference to type 'float' cannot be initialized with a value of type 'int'}} |