r180822 - Fix PR15845: apparently MSVC does not support implicit int in C++ mode.
Richard Smith
richard-llvm at metafoo.co.uk
Tue Apr 30 15:43:51 PDT 2013
Author: rsmith
Date: Tue Apr 30 17:43:51 2013
New Revision: 180822
URL: http://llvm.org/viewvc/llvm-project?rev=180822&view=rev
Log:
Fix PR15845: apparently MSVC does not support implicit int in C++ mode.
Added:
cfe/trunk/test/Sema/MicrosoftCompatibility.cpp
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=180822&r1=180821&r2=180822&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Tue Apr 30 17:43:51 2013
@@ -2038,10 +2038,9 @@ bool Parser::ParseImplicitInt(DeclSpec &
// error, do lookahead to try to do better recovery. This never applies
// within a type specifier. Outside of C++, we allow this even if the
// language doesn't "officially" support implicit int -- we support
- // implicit int as an extension in C99 and C11. Allegedly, MS also
- // supports implicit int in C++ mode.
+ // implicit int as an extension in C99 and C11.
if (DSC != DSC_type_specifier && DSC != DSC_trailing &&
- (!getLangOpts().CPlusPlus || getLangOpts().MicrosoftExt) &&
+ !getLangOpts().CPlusPlus &&
isValidAfterIdentifierInDeclarator(NextToken())) {
// If this token is valid for implicit int, e.g. "static x = 4", then
// we just avoid eating the identifier, so it will be parsed as the
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=180822&r1=180821&r2=180822&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Tue Apr 30 17:43:51 2013
@@ -1003,8 +1003,7 @@ void DeclSpec::Finish(DiagnosticsEngine
// the type specifier is not optional, but we got 'auto' as a storage
// class specifier, then assume this is an attempt to use C++0x's 'auto'
// type specifier.
- // FIXME: Does Microsoft really support implicit int in C++?
- if (PP.getLangOpts().CPlusPlus && !PP.getLangOpts().MicrosoftExt &&
+ if (PP.getLangOpts().CPlusPlus &&
TypeSpecType == TST_unspecified && StorageClassSpec == SCS_auto) {
TypeSpecType = TST_auto;
StorageClassSpec = SCS_unspecified;
Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=180822&r1=180821&r2=180822&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Tue Apr 30 17:43:51 2013
@@ -793,9 +793,7 @@ static QualType ConvertDeclSpecToType(Ty
// "At least one type specifier shall be given in the declaration
// specifiers in each declaration, and in the specifier-qualifier list in
// each struct declaration and type name."
- // FIXME: Does Microsoft really have the implicit int extension in C++?
- if (S.getLangOpts().CPlusPlus &&
- !S.getLangOpts().MicrosoftExt) {
+ if (S.getLangOpts().CPlusPlus) {
S.Diag(DeclLoc, diag::err_missing_type_specifier)
<< DS.getSourceRange();
Modified: cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm?rev=180822&r1=180821&r2=180822&view=diff
==============================================================================
--- cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm (original)
+++ cfe/trunk/test/Rewriter/rewrite-byref-in-nested-blocks.mm Tue Apr 30 17:43:51 2013
@@ -19,7 +19,7 @@ void f(void (^block)(void));
- (void)foo {
__block int kerfluffle;
// radar 7692183
- __block x;
+ __block int x;
f(^{
f(^{
y = 42;
Added: cfe/trunk/test/Sema/MicrosoftCompatibility.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftCompatibility.cpp?rev=180822&view=auto
==============================================================================
--- cfe/trunk/test/Sema/MicrosoftCompatibility.cpp (added)
+++ cfe/trunk/test/Sema/MicrosoftCompatibility.cpp Tue Apr 30 17:43:51 2013
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-compatibility
+
+// PR15845
+int foo(xxx); // expected-error{{unknown type name}}
More information about the cfe-commits
mailing list