forked from OSchip/llvm-project
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>. llvm-svn: 131153
This commit is contained in:
parent
999fa3bf1f
commit
932aac6492
clang
include/clang/Basic
test
|
@ -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<
|
||||
|
|
|
@ -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 { };
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in New Issue