Remove the restriction on module-private friends. Since the friend

declaration may be the first declaration, we want the ability to that
declaration to be marked module-private.

llvm-svn: 139497
This commit is contained in:
Douglas Gregor 2011-09-12 15:48:15 +00:00
parent b63ab9477c
commit fc33bcfc4a
3 changed files with 2 additions and 11 deletions

View File

@ -582,8 +582,6 @@ def err_module_expected_ident : Error<
"expected a module name after '__import_module__'">;
def err_module_expected_semi : Error<
"expected a semicolon name after module name">;
def err_module_private_friend : Error<
"friend cannot be declared __module_private__">;
}
} // end of Parser diagnostics

View File

@ -899,13 +899,6 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
ClearStorageClassSpecs();
}
// A friend cannot be specified as module-private.
if (isFriendSpecified() && isModulePrivateSpecified()) {
Diag(D, ModulePrivateLoc, diag::err_module_private_friend)
<< FixItHint::CreateRemoval(ModulePrivateLoc);
ModulePrivateLoc = SourceLocation();
}
assert(!TypeSpecOwned || isDeclRep((TST) TypeSpecType));
// Okay, now we can infer the real type.

View File

@ -96,8 +96,8 @@ struct public_class {
struct inner_struct;
static int static_var;
friend __module_private__ void public_func(); // expected-error{{friend cannot be declared __module_private__}}
friend __module_private__ struct public_struct; // expected-error{{friend cannot be declared __module_private__}}
friend __module_private__ void public_func_friend();
friend __module_private__ struct public_struct_friend;
};
template<> __module_private__ struct public_class<int>::inner_struct { }; // expected-error{{member specialization cannot be declared __module_private__}}