From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaTemplate/instantiate-function-2.cpp | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 clang/test/SemaTemplate/instantiate-function-2.cpp (limited to 'clang/test/SemaTemplate/instantiate-function-2.cpp') diff --git a/clang/test/SemaTemplate/instantiate-function-2.cpp b/clang/test/SemaTemplate/instantiate-function-2.cpp new file mode 100644 index 0000000..19a8b61 --- /dev/null +++ b/clang/test/SemaTemplate/instantiate-function-2.cpp @@ -0,0 +1,66 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +template struct S { + S() { } + S(T t); +}; + +template struct S; + +void f() { + S s1; + S s2(10); +} + +namespace PR7184 { + template + void f() { + typedef T type; + void g(int array[sizeof(type)]); + } + + template void f(); +} + +namespace UsedAttr { + template + void __attribute__((used)) foo() { + T *x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} + } + + void bar() { + foo(); // expected-note{{instantiation of}} + } +} + +namespace PR9654 { + typedef void ftype(int); + + template + ftype f; + + void g() { + f(0); + } +} + +namespace AliasTagDef { + template + T f() { + using S = struct { // expected-warning {{C++11}} + T g() { + return T(); + } + }; + return S().g(); + } + + int n = f(); +} + +namespace PR10273 { + template void (f)(T t) {} + + void g() { + (f)(17); + } +} -- cgit v1.2.3