Commit c7962e7d by Jason Merrill

re PR c++/37540 (ICE on __decltype of method call in function template)

        PR c++/37540
        * call.c (build_over_call): Take the address of the function even
        in a template.
        (build_new_method_call): Remember the type of the called function
        in a template.

From-SVN: r142054
parent 19523300
2008-11-20 Jason Merrill <jason@redhat.com>
PR c++/37540
* call.c (build_over_call): Take the address of the function even
in a template.
(build_new_method_call): Remember the type of the called function
in a template.
2008-11-19 Dodji Seketeli <dodji@redhat.com>
PR c++/37142
......@@ -8,7 +16,7 @@
PR c++/35405
* pt.c (lookup_template_class): Check pointers before dereferencing
Them.
them.
* error.c (dump_template_decl): Likewise.
2008-11-19 Jason Merrill <jason@redhat.com>
......
......@@ -5103,7 +5103,7 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
tree expr;
tree return_type;
return_type = TREE_TYPE (TREE_TYPE (fn));
expr = build_call_list (return_type, fn, args);
expr = build_call_list (return_type, build_addr_func (fn), args);
if (TREE_THIS_VOLATILE (fn) && cfun)
current_function_returns_abnormally = 1;
if (!VOID_TYPE_P (return_type))
......@@ -5964,10 +5964,16 @@ build_new_method_call (tree instance, tree fns, tree args,
}
if (processing_template_decl && call != error_mark_node)
call = (build_min_non_dep_call_list
(call,
build_min_nt (COMPONENT_REF, orig_instance, orig_fns, NULL_TREE),
orig_args));
{
if (TREE_CODE (call) == INDIRECT_REF)
call = TREE_OPERAND (call, 0);
call = (build_min_non_dep_call_list
(call,
build_min (COMPONENT_REF, TREE_TYPE (CALL_EXPR_FN (call)),
orig_instance, orig_fns, NULL_TREE),
orig_args));
call = convert_from_reference (call);
}
/* Free all the conversions we allocated. */
obstack_free (&conversion_obstack, p);
......
2008-11-20 Jason Merrill <jason@redhat.com>
PR c++/37540
* g++.dg/cpp0x/decltype14.C: New test.
2008-11-20 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37868
......
// PR c++/37540
struct A
{
int g() {return 0;}
};
template <typename T_>
void f(A a)
{
__decltype(a.g()) i;
}
int main()
{
f<int>(A());
}
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