diff options
author | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-05-31 11:47:27 +0000 |
---|---|---|
committer | Sebastian Redl <sebastian.redl@getdesigned.at> | 2009-05-31 11:47:27 +0000 |
commit | 3cc9726a493d90bd8faf094986a59352fd3461cb (patch) | |
tree | 10af8c1f45331dd39bdbef629c21d8682432a895 /lib/Sema/SemaType.cpp | |
parent | bb6415c69fc6440c337970e39749d4d482d9de42 (diff) |
Disallow exception specs on typedefs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@72664 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaType.cpp')
-rw-r--r-- | lib/Sema/SemaType.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp index 833620b5cf..81ac21123e 100644 --- a/lib/Sema/SemaType.cpp +++ b/lib/Sema/SemaType.cpp @@ -737,7 +737,7 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip, // does not have a K&R-style identifier list), then the arguments are part // of the type, otherwise the argument list is (). const DeclaratorChunk::FunctionTypeInfo &FTI = DeclType.Fun; - + // C99 6.7.5.3p1: The return type may not be a function or array type. if (T->isArrayType() || T->isFunctionType()) { Diag(DeclType.Loc, diag::err_func_returning_array_function) << T; @@ -754,6 +754,12 @@ QualType Sema::GetTypeForDeclarator(Declarator &D, Scope *S, unsigned Skip, << Context.getTypeDeclType(Tag); } + // Exception specs are not allowed in typedefs. Complain, but add it + // anyway. + if (FTI.hasExceptionSpec && + D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_typedef) + Diag(FTI.getThrowLoc(), diag::err_exception_spec_in_typedef); + if (FTI.NumArgs == 0) { if (getLangOptions().CPlusPlus) { // C++ 8.3.5p2: If the parameter-declaration-clause is empty, the @@ -978,17 +984,13 @@ bool Sema::CheckSpecifiedExceptionType(QualType T, const SourceRange &Range) { // C++ 15.4p2: A type denoted in an exception-specification shall not denote // an incomplete type a pointer or reference to an incomplete type, other // than (cv) void*. - // The standard does not mention member pointers, but it has to mean them too. int kind; if (const PointerType* IT = T->getAsPointerType()) { T = IT->getPointeeType(); kind = 1; - } else if (const MemberPointerType* IT = T->getAsMemberPointerType()) { - T = IT->getPointeeType(); - kind = 2; } else if (const ReferenceType* IT = T->getAsReferenceType()) { T = IT->getPointeeType(); - kind = 3; + kind = 2; } else return false; |