From ec2b103c267a06a66e926f62cd96767b280f5cf5 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Tue, 2 Jun 2009 17:58:47 +0000 Subject: Import Clang, at r72732. --- test/SemaTemplate/class-template-id.cpp | 38 +++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/SemaTemplate/class-template-id.cpp (limited to 'test/SemaTemplate/class-template-id.cpp') diff --git a/test/SemaTemplate/class-template-id.cpp b/test/SemaTemplate/class-template-id.cpp new file mode 100644 index 0000000000000..e74a6f8dcca92 --- /dev/null +++ b/test/SemaTemplate/class-template-id.cpp @@ -0,0 +1,38 @@ +// RUN: clang-cc -fsyntax-only -verify %s +template struct A { }; + +typedef A A_int; + +typedef float FLOAT; + +A *foo(A *ptr, A const *ptr2, A *ptr3) { + if (ptr) + return ptr; // okay + else if (ptr2) + return ptr2; // expected-error{{incompatible type returning 'A const *', expected 'A *'}} + else { + return ptr3; // expected-error{{incompatible type returning 'A *', expected 'A *'}} + } +} + +template struct B; + +const int value = 12; +B<17 + 2> *bar(B<(19)> *ptr1, B< (::value + 7) > *ptr2, B<19 - 3> *ptr3) { + if (ptr1) + return ptr1; + else if (ptr2) + return ptr2; + else + return ptr3; // expected-error{{incompatible type returning 'B<19 - 3> *', expected 'B<17 + 2> *'}} +} + +typedef B<5> B5; + + +namespace N { + template struct C {}; +} + +N::C c1; +typedef N::C c2; -- cgit v1.2.3