aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Sema/DeclSpec.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Sema/DeclSpec.cpp b/lib/Sema/DeclSpec.cpp
index 55964d5006..531e7a535a 100644
--- a/lib/Sema/DeclSpec.cpp
+++ b/lib/Sema/DeclSpec.cpp
@@ -899,8 +899,15 @@ void DeclSpec::Finish(Diagnostic &D, Preprocessor &PP) {
ClearStorageClassSpecs();
}
- assert(!TypeSpecOwned || isDeclRep((TST) TypeSpecType));
+ // 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.
// TODO: return "auto function" and other bad things based on the real type.