forked from OSchip/llvm-project
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.
llvm-svn: 137904
This commit is contained in:
parent
d5fe9e4d97
commit
4c7269474e
|
@ -5145,7 +5145,7 @@ static void DiagnoseNarrowingInInitList(
|
|||
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 @@ static void DiagnoseNarrowingInInitList(
|
|||
<< 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()
|
||||
|
|
|
@ -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}}
|
||||
|
||||
|
Loading…
Reference in New Issue