1// RUN: %clang_cc1 -fsyntax-only -verify %s
2template <typename T> struct S {
3  S() { }
4  S(T t);
5};
6
7template struct S<int>;
8
9void f() {
10  S<int> s1;
11  S<int> s2(10);
12}
13
14namespace 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
24namespace 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
35namespace 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
46namespace 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
60namespace PR10273 {
61  template<typename T> void (f)(T t) {}
62
63  void g() {
64    (f)(17);
65  }
66}
67
68namespace rdar15464547 {
69  class A {
70    A();
71  };
72
73  template <typename R> class B {
74  public:
75    static void meth1();
76    static void meth2();
77  };
78
79  A::A() {
80    extern int compile_time_assert_failed;
81    B<int>::meth2();
82  }
83
84  template <typename R> void B<R>::meth1() {
85    extern int compile_time_assert_failed;
86  }
87
88  template <typename R> void B<R>::meth2() {
89    extern int compile_time_assert_failed;
90  }
91}
92