semantics.c (finish_compound_literal): Don't call check_narrowing if !(complain ...
authorPaolo Carlini <paolo.carlini@oracle.com>
Sun, 18 Dec 2011 23:39:11 +0000 (23:39 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sun, 18 Dec 2011 23:39:11 +0000 (23:39 +0000)
2011-12-18  Paolo Carlini  <paolo.carlini@oracle.com>

* semantics.c (finish_compound_literal): Don't call check_narrowing
if !(complain & tf_warning_or_error).

From-SVN: r182462

gcc/cp/ChangeLog
gcc/cp/semantics.c

index 18f1dfdd6bdb6a1308ffa134fe0aeb4687b52d5a..7d625eed5548f212f3aa3571cb6e9cb7b094ed62 100644 (file)
@@ -1,3 +1,8 @@
+2011-12-18  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * semantics.c (finish_compound_literal): Don't call check_narrowing
+       if !(complain & tf_warning_or_error).
+
 2011-12-17  Jason Merrill  <jason@redhat.com>
 
        PR c++/51588
index ab9227fa9250f07cbcd6dbd81c99f5e20cf94c17..76b0b18bd69e29c99999109ad4c18f4412dca465 100644 (file)
@@ -2370,7 +2370,8 @@ finish_compound_literal (tree type, tree compound_literal,
     return error_mark_node;
   compound_literal = reshape_init (type, compound_literal, complain);
   if (SCALAR_TYPE_P (type)
-      && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal))
+      && !BRACE_ENCLOSED_INITIALIZER_P (compound_literal)
+      && (complain & tf_warning_or_error))
     check_narrowing (type, compound_literal);
   if (TREE_CODE (type) == ARRAY_TYPE
       && TYPE_DOMAIN (type) == NULL_TREE)