PR c++/80935 - wrong C++17 error with lambda
* decl.c (check_for_uninitialized_const_var): Check is_instantiation_of_constexpr. From-SVN: r252943
This commit is contained in:
parent
3ef1cd3d1e
commit
5de2272480
|
@ -1,5 +1,9 @@
|
|||
2017-09-18 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/80935 - wrong C++17 error with lambda
|
||||
* decl.c (check_for_uninitialized_const_var): Check
|
||||
is_instantiation_of_constexpr.
|
||||
|
||||
PR c++/81671 - nullptr_t template parameter
|
||||
* pt.c (convert_nontype_argument): Fix nullptr_t check.
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
// PR c++/80642
|
||||
// { dg-do compile { target c++14 } }
|
||||
|
||||
int main()
|
||||
{
|
||||
[](auto i)
|
||||
{
|
||||
if (i)
|
||||
{
|
||||
int j;
|
||||
return i + j;
|
||||
}
|
||||
return i;
|
||||
}(0);
|
||||
}
|
Loading…
Reference in New Issue