diff options
author | Douglas Gregor <dgregor@apple.com> | 2011-09-09 21:14:29 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2011-09-09 21:14:29 +0000 |
commit | 6274d30d77870393d83a404dd223b8005f2b8cd5 (patch) | |
tree | 26a257071df6d2f4a6da4d20696ca3695bc54a7a /lib/Sema/DeclSpec.cpp | |
parent | 5db255e02fde04cbfec65e4596a217591933a76b (diff) |
Friends cannot be declared module-private
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139411 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DeclSpec.cpp')
-rw-r--r-- | lib/Sema/DeclSpec.cpp | 9 |
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. |