summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2012-01-24 19:01:26 +0000
committerDouglas Gregor <dgregor@apple.com>2012-01-24 19:01:26 +0000
commit3ecbc3d655a9837915e5f8ec08782a1aac2a4ea4 (patch)
treeadb67493bc83d70113fa4a8e235ac6b9d66b3006 /clang/lib
parent8e2722cdb0f35b2a4a58e08f45c4bd1f66b11e94 (diff)
downloadbcm5719-llvm-3ecbc3d655a9837915e5f8ec08782a1aac2a4ea4.tar.gz
bcm5719-llvm-3ecbc3d655a9837915e5f8ec08782a1aac2a4ea4.zip
Promote the extension warning for attempts to catch a reference or
pointer to incomplete type from an ExtWarn to an error. We put the ExtWarn in place as part of a workaround for Boost (PR6527), but it (1) doesn't actually match a GCC extension and (2) has been fixed for two years in Boost, and (3) causes us to emit code that fails badly at run time, so it's a bad idea to keep it. Fixes PR11803. llvm-svn: 148838
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp13
1 files changed, 3 insertions, 10 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 3f8f585bb00..b710a208314 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -9734,28 +9734,21 @@ VarDecl *Sema::BuildExceptionDeclaration(Scope *S,
Invalid = true;
}
- // GCC allows catching pointers and references to incomplete types
- // as an extension; so do we, but we warn by default.
-
QualType BaseType = ExDeclType;
int Mode = 0; // 0 for direct type, 1 for pointer, 2 for reference
unsigned DK = diag::err_catch_incomplete;
- bool IncompleteCatchIsInvalid = true;
if (const PointerType *Ptr = BaseType->getAs<PointerType>()) {
BaseType = Ptr->getPointeeType();
Mode = 1;
- DK = diag::ext_catch_incomplete_ptr;
- IncompleteCatchIsInvalid = false;
+ DK = diag::err_catch_incomplete_ptr;
} else if (const ReferenceType *Ref = BaseType->getAs<ReferenceType>()) {
// For the purpose of error recovery, we treat rvalue refs like lvalue refs.
BaseType = Ref->getPointeeType();
Mode = 2;
- DK = diag::ext_catch_incomplete_ref;
- IncompleteCatchIsInvalid = false;
+ DK = diag::err_catch_incomplete_ref;
}
if (!Invalid && (Mode == 0 || !BaseType->isVoidType()) &&
- !BaseType->isDependentType() && RequireCompleteType(Loc, BaseType, DK) &&
- IncompleteCatchIsInvalid)
+ !BaseType->isDependentType() && RequireCompleteType(Loc, BaseType, DK))
Invalid = true;
if (!Invalid && !ExDeclType->isDependentType() &&
OpenPOWER on IntegriCloud