[cfe-commits] r137904 - in /cfe/trunk: lib/Sema/SemaInit.cpp test/SemaCXX/microsoft-cxx0x.cpp
Francois Pichet
pichet2000 at gmail.com
Wed Aug 17 17:04:08 PDT 2011
Author: fpichet
Date: Wed Aug 17 19:04:08 2011
New Revision: 137904
URL: http://llvm.org/viewvc/llvm-project?rev=137904&view=rev
Log:
Downgrade "err_init_list_variable_narrowing" into a warning in Microsoft mode even if c++0x is enabled. This necessary to parse MSVC code in C++0x mode.
Added:
cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp
Modified:
cfe/trunk/lib/Sema/SemaInit.cpp
Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=137904&r1=137903&r2=137904&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Wed Aug 17 19:04:08 2011
@@ -5145,7 +5145,7 @@
bool Constant, const APValue &ConstantValue) {
if (Constant) {
S.Diag(InitE->getLocStart(),
- S.getLangOptions().CPlusPlus0x
+ S.getLangOptions().CPlusPlus0x && !S.getLangOptions().Microsoft
? diag::err_init_list_constant_narrowing
: diag::warn_init_list_constant_narrowing)
<< InitE->getSourceRange()
@@ -5153,7 +5153,7 @@
<< EntityType;
} else
S.Diag(InitE->getLocStart(),
- S.getLangOptions().CPlusPlus0x
+ S.getLangOptions().CPlusPlus0x && !S.getLangOptions().Microsoft
? diag::err_init_list_variable_narrowing
: diag::warn_init_list_variable_narrowing)
<< InitE->getSourceRange()
Added: cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp?rev=137904&view=auto
==============================================================================
--- cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp (added)
+++ cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp Wed Aug 17 19:04:08 2011
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 %s -triple i686-pc-win32 -fsyntax-only -Wc++0x-narrowing -Wmicrosoft -verify -fms-extensions -std=c++0x
+
+
+struct A {
+ unsigned int a;
+};
+int b = 3;
+A var = { b }; // expected-warning {{ cannot be narrowed }} expected-note {{override}}
+
+
More information about the cfe-commits
mailing list