Commit 4912defb by Jason Merrill Committed by Jason Merrill

PR c++/84368 - wrong error with local variable in variadic lambda.

	* pt.c (tsubst_pack_expansion): Fix handling of non-packs in
	local_specializations.

From-SVN: r257699
parent 47790631
2018-02-15 Jason Merrill <jason@redhat.com>
PR c++/84368 - wrong error with local variable in variadic lambda.
* pt.c (tsubst_pack_expansion): Fix handling of non-packs in
local_specializations.
2018-02-15 Paolo Carlini <paolo.carlini@oracle.com> 2018-02-15 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84330 PR c++/84330
......
...@@ -11521,8 +11521,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, ...@@ -11521,8 +11521,9 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain,
context. */ context. */
tree gen = TREE_PURPOSE (elt); tree gen = TREE_PURPOSE (elt);
tree inst = TREE_VALUE (elt); tree inst = TREE_VALUE (elt);
if (DECL_PACK_P (inst)) if (DECL_P (inst))
inst = retrieve_local_specialization (inst); if (tree local = retrieve_local_specialization (inst))
inst = local;
/* else inst is already a full instantiation of the pack. */ /* else inst is already a full instantiation of the pack. */
register_local_specialization (inst, gen); register_local_specialization (inst, gen);
} }
......
// PR c++/84368
// { dg-do compile { target c++14 } }
template < typename ... T >
void sink(T ...){}
template < typename ... T >
void foo(T ... v){
[](auto ... v){
auto bar = [](auto, auto){ return 0; };
sink(bar(v, T{}) ...);
}(v ...);
}
int main(){
foo(0);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment