diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-05-10 21:23:31 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-05-10 21:23:31 +0000 |
commit | 44054452c416a622b8f19a6d157a0affc05b9aa8 (patch) | |
tree | 90ad8408e93601d55d273bf06ac4702d5755504d | |
parent | c436708c65be210d2ab761a02df2b6c06bd0a85b (diff) |
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>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131153 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | include/clang/Basic/DiagnosticSemaKinds.td | 5 | ||||
-rw-r--r-- | test/CXX/class.access/class.friend/p2-cxx03.cpp | 2 | ||||
-rw-r--r-- | test/CXX/class/class.friend/p2.cpp | 4 | ||||
-rw-r--r-- | test/Parser/cxx-friend.cpp | 6 |
4 files changed, 9 insertions, 8 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td index 332351bd9b..f65e268b85 100644 --- a/include/clang/Basic/DiagnosticSemaKinds.td +++ b/include/clang/Basic/DiagnosticSemaKinds.td @@ -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< diff --git a/test/CXX/class.access/class.friend/p2-cxx03.cpp b/test/CXX/class.access/class.friend/p2-cxx03.cpp index 0391c4b989..82cddc2bad 100644 --- a/test/CXX/class.access/class.friend/p2-cxx03.cpp +++ b/test/CXX/class.access/class.friend/p2-cxx03.cpp @@ -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 { }; diff --git a/test/CXX/class/class.friend/p2.cpp b/test/CXX/class/class.friend/p2.cpp index eb5036f812..87b69c095f 100644 --- a/test/CXX/class/class.friend/p2.cpp +++ b/test/CXX/class/class.friend/p2.cpp @@ -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 }; diff --git a/test/Parser/cxx-friend.cpp b/test/Parser/cxx-friend.cpp index 59350b5663..a13e7babc5 100644 --- a/test/Parser/cxx-friend.cpp +++ b/test/Parser/cxx-friend.cpp @@ -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(); |