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/SemaObjCXX/deduction.mm | 65 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 clang/test/SemaObjCXX/deduction.mm (limited to 'clang/test/SemaObjCXX/deduction.mm') diff --git a/clang/test/SemaObjCXX/deduction.mm b/clang/test/SemaObjCXX/deduction.mm new file mode 100644 index 0000000..220f368 --- /dev/null +++ b/clang/test/SemaObjCXX/deduction.mm @@ -0,0 +1,65 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +@class NSString; + +// Reduced from WebKit. +namespace test0 { + template struct RemovePointer { + typedef T Type; + }; + + template struct RemovePointer { + typedef T Type; + }; + + template struct RetainPtr { + typedef typename RemovePointer::Type ValueType; + typedef ValueType* PtrType; + RetainPtr(PtrType ptr); + }; + + void test(NSString *S) { + RetainPtr ptr(S); + } + + void test(id S) { + RetainPtr ptr(S); + } +} + +@class Test1Class; +@protocol Test1Protocol; +namespace test1 { + template struct RemovePointer { + typedef T type; + }; + template struct RemovePointer { + typedef T type; + }; + template struct is_same {}; + template struct is_same { + static void foo(); + }; + template struct tester { + void test() { + is_same::type*>::foo(); // expected-error 2 {{no member named 'foo'}} + } + }; + + template struct tester; + template struct tester >; + template struct tester; + template struct tester >; + template struct tester; + template struct tester*>; + + template struct tester; // expected-note {{in instantiation}} + template struct tester >; // expected-note {{in instantiation}} +} + +namespace test2 { + template void foo(const T* t) {} + void test(id x) { + foo(x); + } +} -- cgit v1.2.3