aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2005-02-11 17:15:50 +0000
committerMark Mitchell <mark@codesourcery.com>2005-02-11 17:15:50 +0000
commit0e0cdf0a678d9bba447fb38bc16e8318e0590ce9 (patch)
treed3af2f2df6f0bdaa1e0db957b718d6819eb6f324 /gcc/cp/decl.c
parent7b1f594756acc966c653c24dfaa46061e2d6619e (diff)
PR c++/19755
* decl.c (reshape_init): Issue warnings about missing braces. PR c++/19755 * g++.dg/warn/Wbraces1.C: New test. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@94882 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 05918f553f9..a93cdf8f4c1 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4352,10 +4352,15 @@ reshape_init (tree type, tree *initp)
new_init = build_tree_list (TREE_PURPOSE (old_init), new_init);
}
- /* If this was a brace-enclosed initializer and all of the
- initializers were not used up, there is a problem. */
- if (brace_enclosed_p && *initp)
- error ("too many initializers for %qT", type);
+ /* If there are more initializers than necessary, issue a
+ diagnostic. */
+ if (*initp)
+ {
+ if (brace_enclosed_p)
+ error ("too many initializers for %qT", type);
+ else if (warn_missing_braces)
+ warning ("missing braces around initializer");
+ }
return new_init;
}