summaryrefslogtreecommitdiff
path: root/test/CXX/class.access/class.friend/p3-cxx0x.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/class.access/class.friend/p3-cxx0x.cpp')
-rw-r--r--test/CXX/class.access/class.friend/p3-cxx0x.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/CXX/class.access/class.friend/p3-cxx0x.cpp b/test/CXX/class.access/class.friend/p3-cxx0x.cpp
index 00fc0a33bef2..e4d5fd55b0b6 100644
--- a/test/CXX/class.access/class.friend/p3-cxx0x.cpp
+++ b/test/CXX/class.access/class.friend/p3-cxx0x.cpp
@@ -27,3 +27,29 @@ struct Y3 {
X1<Y2> x1a;
X1<Y3> x1b;
X1<Y1> x1c; // expected-note{{in instantiation of template class 'X1<Y1>' requested here}}
+
+template<typename T>
+class A {
+ T x;
+public:
+ class foo {};
+ static int y;
+};
+
+struct {
+ // Ill-formed
+ int friend; // expected-error {{'friend' must appear first in a non-function declaration}}
+ unsigned friend int; // expected-error {{'friend' must appear first in a non-function declaration}}
+ const volatile friend int; // expected-error {{'friend' must appear first in a non-function declaration}}
+ int
+ friend; // expected-error {{'friend' must appear first in a non-function declaration}}
+
+ // OK
+ int friend foo(void);
+ friend int;
+ friend const volatile int;
+ friend
+
+ float;
+ template<typename T> friend class A<T>::foo;
+} a;