diff options
| author | John McCall <rjmccall@apple.com> | 2009-12-22 00:59:39 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2009-12-22 00:59:39 +0000 |
| commit | 463e10cbd53aceb554b0d62fdad3554cc9816246 (patch) | |
| tree | 6d7e9d633bb4a25b0c1a8ca1221ea355bbdd3827 /clang | |
| parent | 84463813a1de55f280cbfb55e540a2251e09802a (diff) | |
| download | bcm5719-llvm-463e10cbd53aceb554b0d62fdad3554cc9816246.tar.gz bcm5719-llvm-463e10cbd53aceb554b0d62fdad3554cc9816246.zip | |
Stop diagnosing the use of inner classes as friends. ddunbar asked whether
this was useful, and on review Doug and I decided it was probably on the level
of a bug in the standard and therefore not worth a warning even in -pedantic.
If someone disagrees and urgently wants clang++ to warn about this in strict
c++98 mode, we can talk about it.
llvm-svn: 91868
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/include/clang/Basic/DiagnosticSemaKinds.td | 2 | ||||
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 11 |
2 files changed, 4 insertions, 9 deletions
diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 3662bd4793d..eece90b42a6 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -351,8 +351,6 @@ def err_enum_friend : Error< "enum types cannot be friends">; def err_friend_is_member : Error< "friends cannot be members of the declaring class">; -def ext_friend_inner_class : Extension< - "C++ 98 does not allow inner classes as friends">; def err_unelaborated_friend_type : Error< "must specify '%select{struct|union|class|enum}0' to befriend %1">; def err_qualified_friend_not_found : Error< diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index 1f3fbba629e..13b65e3000b 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -5196,13 +5196,10 @@ Sema::DeclPtrTy Sema::ActOnFriendTypeDecl(Scope *S, const DeclSpec &DS, // C++98 [class.friend]p1: A friend of a class is a function // or class that is not a member of the class . . . - // But that's a silly restriction which nobody implements for - // inner classes, and C++0x removes it anyway, so we only report - // this (as a warning) if we're being pedantic. - if (!getLangOptions().CPlusPlus0x) - if (const RecordType *RT = T->getAs<RecordType>()) - if (RT->getDecl()->getDeclContext() == CurContext) - Diag(DS.getFriendSpecLoc(), diag::ext_friend_inner_class); + // This is fixed in DR77, which just barely didn't make the C++03 + // deadline. It's also a very silly restriction that seriously + // affects inner classes and which nobody else seems to implement; + // thus we never diagnose it, not even in -pedantic. Decl *D; if (TempParams.size()) |

