I have attached patch for http://llvm.org/bugs/show_bug.cgi?id=16395.
Bail out, if HandleMSProperty returns null.
While HandleField never returns null, HandleMSProperty does on error.
Testcase and bug report by Eli Friedman.
Please review.
Thanks,
Robert
Index: lib/Sema/SemaDeclCXX.cpp
===================================================================
--- lib/Sema/SemaDeclCXX.cpp (revision 184670)
+++ lib/Sema/SemaDeclCXX.cpp (working copy)
@@ -1935,12 +1935,15 @@
if (MSPropertyAttr) {
Member = HandleMSProperty(S, cast<CXXRecordDecl>(CurContext), Loc, D,
BitWidth, InitStyle, AS, MSPropertyAttr);
+ if (!Member) {
+ return 0;
+ }
isInstField = false;
} else {
Member = HandleField(S, cast<CXXRecordDecl>(CurContext), Loc, D,
BitWidth, InitStyle, AS);
+ assert(Member && "HandleField never returns null");
}
- assert(Member && "HandleField never returns null");
} else {
assert(InitStyle == ICIS_NoInit || D.getDeclSpec().getStorageClassSpec() == DeclSpec::SCS_static);
Index: test/SemaCXX/MicrosoftExtensions.cpp
===================================================================
--- test/SemaCXX/MicrosoftExtensions.cpp (revision 184665)
+++ test/SemaCXX/MicrosoftExtensions.cpp (working copy)
@@ -361,3 +361,7 @@
TakeRef(V);
TakeVal(V);
}
+
+struct StructWithUnnamedMember {
+ __declspec(property(get=GetV)) int : 10; // expected-error {{anonymous property is not supported}}
+};
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits