Home | History | Annotate | Download | only in SemaTemplate
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 template <typename T> struct S {
      3   S() { }
      4   S(T t);
      5 };
      6 
      7 template struct S<int>;
      8 
      9 void f() {
     10   S<int> s1;
     11   S<int> s2(10);
     12 }
     13 
     14 namespace PR7184 {
     15   template<typename T>
     16   void f() {
     17     typedef T type;
     18     void g(int array[sizeof(type)]);
     19   }
     20 
     21   template void f<int>();
     22 }
     23 
     24 namespace UsedAttr {
     25   template<typename T>
     26   void __attribute__((used)) foo() {
     27     T *x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
     28   }
     29 
     30   void bar() {
     31     foo<int>(); // expected-note{{instantiation of}}
     32   }
     33 }
     34 
     35 namespace PR9654 {
     36   typedef void ftype(int);
     37 
     38   template<typename T>
     39   ftype f;
     40 
     41   void g() {
     42     f<int>(0);
     43   }
     44 }
     45 
     46 namespace AliasTagDef {
     47   template<typename T>
     48   T f() {
     49     using S = struct { // expected-warning {{C++11}}
     50       T g() {
     51         return T();
     52       }
     53     };
     54     return S().g();
     55   }
     56 
     57   int n = f<int>();
     58 }
     59 
     60 namespace PR10273 {
     61   template<typename T> void (f)(T t) {}
     62 
     63   void g() {
     64     (f)(17);
     65   }
     66 }
     67