From: Abramo Bagnara Date: Sat, 28 Jan 2012 11:04:22 +0000 (+0000) Subject: Added tests for template keyword presence. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=bd2b6f0e57e2380bd992f50af434a9970d8e23bb;p=clang Added tests for template keyword presence. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149177 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/SemaTemplate/template-id-printing.cpp b/test/SemaTemplate/template-id-printing.cpp index fcd4974a76..3b9e25196d 100644 --- a/test/SemaTemplate/template-id-printing.cpp +++ b/test/SemaTemplate/template-id-printing.cpp @@ -11,3 +11,122 @@ void g() { // 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