diff options
author | John McCall <rjmccall@apple.com> | 2010-10-14 22:22:28 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-10-14 22:22:28 +0000 |
commit | f4776590402a62ff1517aa07f2d1e7284b80a5bc (patch) | |
tree | 230af3d52c60da19974591adab08524b59d6e242 /clang/test | |
parent | 57756eabc9a12450404f649daac86a620230e05d (diff) | |
download | bcm5719-llvm-f4776590402a62ff1517aa07f2d1e7284b80a5bc.tar.gz bcm5719-llvm-f4776590402a62ff1517aa07f2d1e7284b80a5bc.zip |
template-ids are looked up differently in friend declarations.
llvm-svn: 116529
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/clang/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp b/clang/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp index ddcbe785a73..069ca0a9258 100644 --- a/clang/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp +++ b/clang/test/CXX/dcl.dcl/basic.namespace/namespace.def/namespace.memdef/p3.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only %s +// RUN: %clang_cc1 -fsyntax-only %s -verify // C++'0x [namespace.memdef] p3: // Every name first declared in a namespace is a member of that namespace. If @@ -66,3 +66,28 @@ namespace N3 { } // FIXME: Woefully inadequate for testing + +// Friends declared as template-ids aren't subject to the restriction +// on innermost namespaces. +// rdar://problem/8552377 +namespace test5 { + template <class T> void f(T); + namespace ns { + class A { + friend void f<int>(int); + static void foo(); // expected-note 2 {{declared private here}} + }; + + // Note that this happens without instantiation. + template <class T> void f(T) { + A::foo(); // expected-error {{'foo' is a private member of 'test5::ns::A'}} + } + } + + template <class T> void f(T) { + ns::A::foo(); // expected-error {{'foo' is a private member of 'test5::ns::A'}} + } + + template void f<int>(int); + template void f<long>(long); //expected-note {{instantiation}} +} |