]> granicus.if.org Git - clang/commitdiff
Tweak the diagnostics for the C++0x extensions to friend types to note
authorDouglas Gregor <dgregor@apple.com>
Tue, 10 May 2011 21:23:31 +0000 (21:23 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 10 May 2011 21:23:31 +0000 (21:23 +0000)
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131153 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/CXX/class.access/class.friend/p2-cxx03.cpp
test/CXX/class/class.friend/p2.cpp
test/Parser/cxx-friend.cpp

index 332351bd9b2843702b854f81616d6f31a33ad876..f65e268b850efba1ade027858f82a65688b820e2 100644 (file)
@@ -509,11 +509,12 @@ def err_unexpected_friend : Error<
 def ext_enum_friend : ExtWarn<
   "enumeration type %0 cannot be a friend">;
 def ext_nonclass_type_friend : ExtWarn<
-  "non-class type %0 cannot be a friend">;
+  "non-class friend type %0 is a C++0x extension">, InGroup<CXX0x>;
 def err_friend_is_member : Error<
   "friends cannot be members of the declaring class">;
 def ext_unelaborated_friend_type : ExtWarn<
-  "must specify '%select{struct|union|class|enum}0' to befriend %1">;
+  "specify '%select{struct|union|class|enum}0' to befriend %1; accepted "
+  "as a C++0x extension">, InGroup<CXX0x>;
 def err_qualified_friend_not_found : Error<
   "no function named %0 with type %1 was found in the specified scope">;
 def err_introducing_special_friend : Error<
index 0391c4b989d2e6b52fce1b0cc76991f3ca578614..82cddc2bad50ec07e536951a5fc56226d3674a0a 100644 (file)
@@ -1,7 +1,7 @@
 // RUN: %clang_cc1 -fsyntax-only -verify %s
 template<typename T>
 class X0 {
-  friend T; // expected-warning{{non-class type 'T' cannot be a friend}}
+  friend T; // expected-warning{{non-class friend type 'T' is a C++0x extension}}
 };
 
 class X1 { };
index eb5036f812871664fb2e8c05ba894336f4075cc9..87b69c095fbdcad95daa8a15f7d071dfdfe22654 100644 (file)
@@ -4,7 +4,7 @@ struct B0;
 
 class A {
   friend class B {}; // expected-error {{cannot define a type in a friend declaration}}
-  friend int; // expected-warning {{non-class type 'int' cannot be a friend}}
-  friend B0; // expected-warning {{must specify 'struct' to befriend}}
+  friend int; // expected-warning {{non-class friend type 'int' is a C++0x extension}}
+  friend B0; // expected-warning {{specify 'struct' to befriend 'B0'}}
   friend class C; // okay
 };
index 59350b5663676540ad76887cd5459c54e56401c5..a13e7babc534fb911437c425edfc2196c31fb9d6 100644 (file)
@@ -21,9 +21,9 @@ class B {
   // 'A' here should refer to the declaration above.  
   friend class A;
 
-  friend C; // expected-warning {{must specify 'class' to befriend}}
-  friend U; // expected-warning {{must specify 'union' to befriend}}
-  friend int; // expected-warning {{non-class type 'int' cannot be a friend}}
+  friend C; // expected-warning {{specify 'class' to befriend}}
+  friend U; // expected-warning {{specify 'union' to befriend}}
+  friend int; // expected-warning {{non-class friend type 'int'}}
 
   friend void myfunc();