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/template-id-printing.cpp | 141 +++++++++++++++++++++++ 1 file changed, 141 insertions(+) create mode 100644 clang/test/SemaTemplate/template-id-printing.cpp (limited to 'clang/test/SemaTemplate/template-id-printing.cpp') diff --git a/clang/test/SemaTemplate/template-id-printing.cpp b/clang/test/SemaTemplate/template-id-printing.cpp new file mode 100644 index 0000000..047589b --- /dev/null +++ b/clang/test/SemaTemplate/template-id-printing.cpp @@ -0,0 +1,141 @@ +// RUN: %clang_cc1 -fsyntax-only -ast-print %s | FileCheck %s +namespace N { + template void f(U); + template void f(); +} + +void g() { + // CHECK: N::f(3.14 + N::f(3.14); + + // CHECK: N::f + void (*fp)(int) = N::f; +} + + +// (NNS qualified) DeclRefExpr. +namespace DRE { + +template +void foo(); + +void test() { + // CHECK: DRE::foo; + DRE::foo; + // CHECK: DRE::template foo; + DRE::template foo; + // CHECK: DRE::foo(); + DRE::foo(); + // CHECK: DRE::template foo(); + DRE::template foo(); +} + +} // namespace DRE + + +// MemberExpr. +namespace ME { + +struct S { + template + void mem(); +}; + +void test() { + S s; + // CHECK: s.mem(); + s.mem(); + // CHECK: s.template mem(); + s.template mem(); +} + +} // namespace ME + + +// UnresolvedLookupExpr. +namespace ULE { + +template +int foo(); + +template +void test() { + // CHECK: ULE::foo; + ULE::foo; + // CHECK: ULE::template foo; + ULE::template foo; +} + +} // namespace ULE + + +// UnresolvedMemberExpr. +namespace UME { + +struct S { + template + void mem(); +}; + +template +void test() { + S s; + // CHECK: s.mem(); + s.mem(); + // CHECK: s.template mem(); + s.template mem(); +} + +} // namespace UME + + +// DependentScopeDeclRefExpr. +namespace DSDRE { + +template +struct S; + +template +void test() { + // CHECK: S::foo; + S::foo; + // CHECK: S::template foo; + S::template foo; + // CHECK: S::template foo<>; + S::template foo<>; + // CHECK: S::template foo; + S::template foo; +} + +} // namespace DSDRE + + +// DependentScopeMemberExpr. +namespace DSME { + +template +struct S; + +template +void test() { + S s; + // CHECK: s.foo; + s.foo; + // CHECK: s.template foo; + s.template foo; + // CHECK: s.template foo<>; + s.template foo<>; + // CHECK: s.template foo; + s.template foo; +} + +} // namespace DSME + +namespace DSDRE_withImplicitTemplateArgs { + +template void foo() { + // CHECK: T::template bar(); + T::template bar(); +} + +} // namespace DSDRE_withImplicitTemplateArgs -- cgit v1.2.3