diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-12-15 23:53:10 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-12-15 23:53:10 +0000 |
commit | 584049d49d956add7bce5669e9823491f7d8de78 (patch) | |
tree | 99066aa31417bc3481e7216db2dc8b21325e74a0 /lib/Sema/SemaType.cpp | |
parent | 03f332a8f4300bbaa91240f461923e7874892dd3 (diff) |
Diagnose erroneous uses of out-of-line member definitions and scope
specifiers. Specifically:
* Determine when an out-of-line function definition does not match
any declaration within the class or namespace (including coping
with overloaded functions).
* Complain about typedefs and parameters that have scope specifiers.
* Complain about out-of-line declarations that aren't also
definitions.
* Complain about non-static data members being declared out-of-line.
* Allow cv-qualifiers on out-of-line member function definitions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61058 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 2423e1271b..3f911f5b0c 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -533,9 +533,11 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip) { // declaration. if (FnTy->getTypeQuals() != 0 && D.getDeclSpec().getStorageClassSpec() != DeclSpec::SCS_typedef && - (D.getContext() != Declarator::MemberContext || + ((D.getContext() != Declarator::MemberContext && + (!D.getCXXScopeSpec().isSet() || + !static_cast<DeclContext*>(D.getCXXScopeSpec().getScopeRep()) + ->isCXXRecord())) || D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static)) { - if (D.isFunctionDeclarator()) Diag(D.getIdentifierLoc(), diag::err_invalid_qualified_function_type); else |