[cfe-commits] r131153 - in /cfe/trunk: 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

Douglas Gregor dgregor at apple.com
Tue May 10 14:23:31 PDT 2011


Author: dgregor
Date: Tue May 10 16:23:31 2011
New Revision: 131153

URL: http://llvm.org/viewvc/llvm-project?rev=131153&view=rev
Log:
Tweak the diagnostics for the C++0x extensions to friend types to note
that they are C++0x extensions, and put them in the appropriate
group. We already support most of the semantics. Addresses
<rdar://problem/9407525>.

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

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=131153&r1=131152&r2=131153&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue May 10 16:23:31 2011
@@ -509,11 +509,12 @@
 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<

Modified: cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp?rev=131153&r1=131152&r2=131153&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp (original)
+++ cfe/trunk/test/CXX/class.access/class.friend/p2-cxx03.cpp Tue May 10 16:23:31 2011
@@ -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 { };

Modified: cfe/trunk/test/CXX/class/class.friend/p2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/class/class.friend/p2.cpp?rev=131153&r1=131152&r2=131153&view=diff
==============================================================================
--- cfe/trunk/test/CXX/class/class.friend/p2.cpp (original)
+++ cfe/trunk/test/CXX/class/class.friend/p2.cpp Tue May 10 16:23:31 2011
@@ -4,7 +4,7 @@
 
 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
 };

Modified: cfe/trunk/test/Parser/cxx-friend.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-friend.cpp?rev=131153&r1=131152&r2=131153&view=diff
==============================================================================
--- cfe/trunk/test/Parser/cxx-friend.cpp (original)
+++ cfe/trunk/test/Parser/cxx-friend.cpp Tue May 10 16:23:31 2011
@@ -21,9 +21,9 @@
   // '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();
 





More information about the cfe-commits mailing list