[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / SemaTemplate / instantiate-function-2.cpp
blob40d4a19cd081251fd0a4e180ab85c0f7a33cde91
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
5 template <typename T> struct S {
6 S() { }
7 S(T t);
8 };
10 template struct S<int>;
12 void f() {
13 S<int> s1;
14 S<int> s2(10);
17 namespace PR7184 {
18 template<typename T>
19 void f() {
20 typedef T type;
21 void g(int array[sizeof(type)]);
24 template void f<int>();
27 namespace UsedAttr {
28 template<typename T>
29 void __attribute__((used)) foo() {
30 T *x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}}
33 void bar() {
34 foo<int>(); // expected-note{{instantiation of}}
38 namespace PR9654 {
39 typedef void ftype(int);
41 template<typename T>
42 ftype f;
44 void g() {
45 f<int>(0);
49 namespace AliasTagDef {
50 template<typename T>
51 T f() {
52 using S = struct { // expected-warning {{add a tag name}} expected-note {{}}
53 #if __cplusplus <= 199711L
54 // expected-warning@-2 {{alias declarations are a C++11 extension}}
55 #endif
56 T g() { // expected-note {{}}
57 return T();
60 return S().g();
63 int n = f<int>();
66 namespace PR10273 {
67 template<typename T> void (f)(T t) {}
69 void g() {
70 (f)(17);
74 namespace rdar15464547 {
75 class A {
76 A();
79 template <typename R> class B {
80 public:
81 static void meth1();
82 static void meth2();
85 A::A() {
86 extern int compile_time_assert_failed;
87 B<int>::meth2();
90 template <typename R> void B<R>::meth1() {
91 extern int compile_time_assert_failed;
94 template <typename R> void B<R>::meth2() {
95 extern int compile_time_assert_failed;