Commit a397bb72 by Jason Merrill Committed by Jason Merrill

re PR c++/44967 ([C++0x] decltype of method call dependent on pack expansion crashes)

	PR c++/44967
	* pt.c (tsubst_copy_and_build): Handle partial substitution of
	CALL_EXPR.

From-SVN: r162343
parent caa4a250
2010-07-20 Jason Merrill <jason@redhat.com>
PR c++/44967
* pt.c (tsubst_copy_and_build): Handle partial substitution of
CALL_EXPR.
2010-07-19 Jason Merrill <jason@redhat.com>
PR c++/44996
......
......@@ -12500,6 +12500,15 @@ tsubst_copy_and_build (tree t,
}
}
if (processing_template_decl
&& (type_dependent_expression_p (function)
|| any_type_dependent_arguments_p (call_args)))
{
ret = build_nt_call_vec (function, call_args);
KOENIG_LOOKUP_P (ret) = koenig_p;
goto call_out;
}
/* We do not perform argument-dependent lookup if normal
lookup finds a non-function, in accordance with the
expected resolution of DR 218. */
......@@ -12512,15 +12521,14 @@ tsubst_copy_and_build (tree t,
|| TREE_CODE (function) == IDENTIFIER_NODE)
/* Only do this when substitution turns a dependent call
into a non-dependent call. */
&& type_dependent_expression_p_push (t)
&& !any_type_dependent_arguments_p (call_args))
&& type_dependent_expression_p_push (t))
function = perform_koenig_lookup (function, call_args);
if (TREE_CODE (function) == IDENTIFIER_NODE)
{
unqualified_name_lookup_error (function);
release_tree_vector (call_args);
return error_mark_node;
ret = error_mark_node;
goto call_out;
}
/* Remember that there was a reference to this entity. */
......@@ -12551,6 +12559,7 @@ tsubst_copy_and_build (tree t,
koenig_p,
complain);
call_out:
release_tree_vector (call_args);
return ret;
......
2010-07-20 Jason Merrill <jason@redhat.com>
PR c++/44967
* g++.dg/cpp0x/sfinae2.C: New.
2010-07-20 Richard Guenther <rguenther@suse.de>
PR lto/42696
......
// PR c++/44967
// { dg-options -std=c++0x }
template <typename T> T&& declval();
template<typename T1, typename T2, typename... Args>
struct has_construct
{
typedef char one;
typedef struct {char _m[2]; } two;
template<typename U1, typename U2, typename... Args2>
static decltype(declval<U1>().construct(declval<U2*>(), declval<Args2>()...), one()) test(int);
template<typename, typename, typename...>
static two test(...);
static const bool value = sizeof(test<T1, T2, Args...>(0)) == 1;
};
struct A0
{};
struct A1
{
void construct(int*, int);
};
template<typename _Tp>
struct A2
{
template<typename _Tp1, typename... _Args>
void construct(_Tp1*, _Args&&...) {}
};
#define SA(X) static_assert(X,#X)
SA((!has_construct<A0, int, int>::value)); // ok
SA((has_construct<A1, int, int>::value)); // bang
SA((has_construct<A2<int>, int>::value)); // bang
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