summaryrefslogtreecommitdiff
path: root/lib/Sema/SemaExceptionSpec.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2016-06-10 18:24:41 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2016-06-10 18:24:41 +0000
commit0baecc728c4a43d8050fbb4c0e6e91a01c5836e4 (patch)
tree418f17bbe04bccaf038cd1f950317602e7232c0a /lib/Sema/SemaExceptionSpec.cpp
parent5f44510ba8b3aca8a62e70388a70737614df2914 (diff)
downloadclang-0baecc728c4a43d8050fbb4c0e6e91a01c5836e4.tar.gz
[-fms-extensions] Permit incomplete types in dynamic exception specifications
Microsoft headers, comdef.h and comutil.h, assume that this is an OK thing to do. Downgrade the hard error to a warning if we are in -fms-extensions mode. This fixes PR28080. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@272412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaExceptionSpec.cpp')
-rw-r--r--lib/Sema/SemaExceptionSpec.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Sema/SemaExceptionSpec.cpp b/lib/Sema/SemaExceptionSpec.cpp
index f12bf2415d..f2ae6bfe2f 100644
--- a/lib/Sema/SemaExceptionSpec.cpp
+++ b/lib/Sema/SemaExceptionSpec.cpp
@@ -110,10 +110,13 @@ bool Sema::CheckSpecifiedExceptionType(QualType &T, SourceRange Range) {
// A type denoted in an exception-specification shall not denote a
// pointer or reference to an incomplete type, other than (cv) void* or a
// pointer or reference to a class currently being defined.
+ // In Microsoft mode, downgrade this to a warning.
+ unsigned DiagID = diag::err_incomplete_in_exception_spec;
+ if (getLangOpts().MicrosoftExt)
+ DiagID = diag::ext_incomplete_in_exception_spec;
if (!(PointeeT->isRecordType() &&
PointeeT->getAs<RecordType>()->isBeingDefined()) &&
- RequireCompleteType(Range.getBegin(), PointeeT,
- diag::err_incomplete_in_exception_spec, Kind, Range))
+ RequireCompleteType(Range.getBegin(), PointeeT, DiagID, Kind, Range))
return true;
return false;