diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-10 22:18:57 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-03-10 22:18:57 +0000 |
commit | e5658f0ab2a6f8fea258adb64edbb8485bb21dee (patch) | |
tree | 00f5094f2b4d8f874bf78d2786306159f7f6aadf /lib/Sema/SemaDeclCXX.cpp | |
parent | 09c9a5635f10a7dfa3373ef0941597c16b048362 (diff) |
PR12225: The requirement that literal operators be namespace-scope functions
does not imply that such functions can't be declared at block scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152509 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclCXX.cpp')
-rw-r--r-- | lib/Sema/SemaDeclCXX.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp index a5b74575b6..29df5c12a6 100644 --- a/lib/Sema/SemaDeclCXX.cpp +++ b/lib/Sema/SemaDeclCXX.cpp @@ -9309,10 +9309,7 @@ bool Sema::CheckOverloadedOperatorDeclaration(FunctionDecl *FnDecl) { /// of this literal operator function is well-formed. If so, returns /// false; otherwise, emits appropriate diagnostics and returns true. bool Sema::CheckLiteralOperatorDeclaration(FunctionDecl *FnDecl) { - DeclContext *DC = FnDecl->getDeclContext(); - Decl::Kind Kind = DC->getDeclKind(); - if (Kind != Decl::TranslationUnit && Kind != Decl::Namespace && - Kind != Decl::LinkageSpec) { + if (isa<CXXMethodDecl>(FnDecl)) { Diag(FnDecl->getLocation(), diag::err_literal_operator_outside_namespace) << FnDecl->getDeclName(); return true; |