aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 8e9a466afa0..f2cd336146c 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5579,9 +5579,10 @@ check_for_uninitialized_const_var (tree decl)
"uninitialized const %qD", decl);
else
{
- error_at (DECL_SOURCE_LOCATION (decl),
- "uninitialized variable %qD in %<constexpr%> function",
- decl);
+ if (!is_instantiation_of_constexpr (current_function_decl))
+ error_at (DECL_SOURCE_LOCATION (decl),
+ "uninitialized variable %qD in %<constexpr%> function",
+ decl);
cp_function_chain->invalid_constexpr = true;
}
@@ -6099,7 +6100,10 @@ reshape_init (tree type, tree init, tsubst_flags_t complain)
{
tree elt = CONSTRUCTOR_ELT (init, 0)->value;
if (check_narrowing (ENUM_UNDERLYING_TYPE (type), elt, complain))
- return cp_build_c_cast (type, elt, tf_warning_or_error);
+ {
+ warning_sentinel w (warn_useless_cast);
+ return cp_build_c_cast (type, elt, tf_warning_or_error);
+ }
else
return error_mark_node;
}