Commit a7137ee1 by Jason Merrill Committed by Jason Merrill

re PR c++/56614 (error: default argument…

re PR c++/56614 (error: default argument 'std::vector<E>(std::initializer_list<E>{((const E*)(& ._0)), 1u}, (*(const std::allocator<E>*)(& std::allocator<E>())))' uses local variable '._0')

	PR c++/56614
	* decl.c (local_variable_p_walkfn): Check DECL_ARTIFICIAL again.

From-SVN: r196658
parent e9d5a271
2013-03-14 Jason Merrill <jason@redhat.com>
PR c++/56614
* decl.c (local_variable_p_walkfn): Check DECL_ARTIFICIAL again.
PR c++/56346
* decl.c (register_dtor_fn): Pass null to __cxa_thread_atexit
dso_handle parm on targets without __cxa_atexit.
......
......@@ -10803,9 +10803,8 @@ static tree
local_variable_p_walkfn (tree *tp, int *walk_subtrees,
void * /*data*/)
{
/* Check DECL_NAME to avoid including temporaries. We don't check
DECL_ARTIFICIAL because we do want to complain about 'this'. */
if (local_variable_p (*tp) && DECL_NAME (*tp))
if (local_variable_p (*tp)
&& (!DECL_ARTIFICIAL (*tp) || DECL_NAME (*tp) == this_identifier))
return *tp;
else if (TYPE_P (*tp))
*walk_subtrees = 0;
......
// PR c++/56614
// { dg-require-effective-target c++11 }
#include <initializer_list>
namespace std
{
template<typename T>
struct allocator
{ };
template<typename T, typename Alloc = std::allocator<T> >
struct vector
{
vector(std::initializer_list<T>, const Alloc& = Alloc()) { }
};
}
void func() { }
enum E { ee };
struct C
{
template<typename T>
C(T, std::vector<E> = std::vector<E>({ ee }))
{ }
};
struct G
{
void gen()
{
C c(&func);
}
};
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