aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-08-29 15:51:30 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-08-29 15:51:30 -0400
commit5d4e573b28a74218ea9db6b00f50f5e323899e6d (patch)
tree8d60fba745a9b87bc0bf687a4dca57ccb6d2fd9a /gcc/cp/decl.c
parent11399477539ec605bd904543163c9e9137395943 (diff)
downloadgcc-5d4e573b28a74218ea9db6b00f50f5e323899e6d.zip
gcc-5d4e573b28a74218ea9db6b00f50f5e323899e6d.tar.gz
gcc-5d4e573b28a74218ea9db6b00f50f5e323899e6d.tar.bz2
PR c++/80935 - wrong C++17 error with lambda
* decl.c (check_for_uninitialized_const_var): Check is_instantiation_of_constexpr. * constexpr.c (ensure_literal_type_for_constexpr_object): Check is_instantiation_of_constexpr. (potential_constant_expression_1): Check var_in_maybe_constexpr_fn. From-SVN: r251429
Diffstat (limited to 'gcc/cp/decl.c')
-rw-r--r--gcc/cp/decl.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index ff3127e..23829b0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -5525,9 +5525,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;
}