re PR c++/45378 ([C++0x] Narrowing error not detected)
PR c++/45378 * decl.c (check_initializer): Check narrowing. From-SVN: r175122
This commit is contained in:
parent
8787a05aaa
commit
fa54bbb75d
|
@ -1,5 +1,8 @@
|
|||
2011-06-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/45378
|
||||
* decl.c (check_initializer): Check narrowing.
|
||||
|
||||
PR c++/49229
|
||||
* pt.c (tsubst_decl) [FUNCTION_DECL]: Handle substitution failure.
|
||||
|
||||
|
|
|
@ -5464,7 +5464,11 @@ check_initializer (tree decl, tree init, int flags, tree *cleanup)
|
|||
init = error_mark_node;
|
||||
}
|
||||
else
|
||||
init = reshape_init (type, init, tf_warning_or_error);
|
||||
{
|
||||
init = reshape_init (type, init, tf_warning_or_error);
|
||||
if (cxx_dialect >= cxx0x && SCALAR_TYPE_P (type))
|
||||
check_narrowing (type, init);
|
||||
}
|
||||
}
|
||||
|
||||
/* If DECL has an array type without a specific bound, deduce the
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
2011-06-16 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/45378
|
||||
* g++.dg/cpp0x/initlist52.C New.
|
||||
|
||||
PR c++/45399
|
||||
* c-c++-common/raw-string-12.c: New.
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
// PR c++/45378
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
int main()
|
||||
{
|
||||
int x { 22.2 }; // { dg-error "narrowing" }
|
||||
}
|
Loading…
Reference in New Issue