diff options
| author | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-02-07 22:51:16 +0000 |
|---|---|---|
| committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2014-02-07 22:51:16 +0000 |
| commit | c7fb225cdc4662535340acb5ee0749a5c6d3c7d3 (patch) | |
| tree | 614a749d7eee9bc9147f4950a8043cad550d62be /clang/lib | |
| parent | 3d8a106f6f3afae80e02023721cbf65edc9c0c43 (diff) | |
| download | bcm5719-llvm-c7fb225cdc4662535340acb5ee0749a5c6d3c7d3.tar.gz bcm5719-llvm-c7fb225cdc4662535340acb5ee0749a5c6d3c7d3.zip | |
PR16638, DR1552: the exception specification on an implicitly-declared
'operator delete' or 'operator delete[]' is an explicit exception
specification. Therefore we should diagnose 'void operator delete(void*)'
instead of 'void operator delete(void*) noexcept'.
This diagnostic remains an ExtWarn, since in practice people don't always
include the exception specification in such a declaration.
llvm-svn: 201002
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Sema/SemaExceptionSpec.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaExceptionSpec.cpp b/clang/lib/Sema/SemaExceptionSpec.cpp index 2eee07c0afd..1c2a8dbc301 100644 --- a/clang/lib/Sema/SemaExceptionSpec.cpp +++ b/clang/lib/Sema/SemaExceptionSpec.cpp @@ -140,10 +140,13 @@ static bool hasImplicitExceptionSpec(FunctionDecl *Decl) { Decl->getDeclName().getCXXOverloadedOperator() != OO_Array_Delete) return false; - // If the user didn't declare the function, its exception specification must - // be implicit. + // For a function that the user didn't declare: + // - if this is a destructor, its exception specification is implicit. + // - if this is 'operator delete' or 'operator delete[]', the exception + // specification is as-if an explicit exception specification was given + // (per [basic.stc.dynamic]p2). if (!Decl->getTypeSourceInfo()) - return true; + return isa<CXXDestructorDecl>(Decl); const FunctionProtoType *Ty = Decl->getTypeSourceInfo()->getType()->getAs<FunctionProtoType>(); |

