Commit 18802917 by Jason Merrill Committed by Jason Merrill

re PR c++/37439 (ICE using auto return-type in template function)

        PR c++/37439
        * pt.c (tsubst_copy) [PARM_DECL]: Don't abort if the parm has
        DECL_CONTEXT set.

From-SVN: r140176
parent 07ebe945
2008-09-09 Jason Merrill <jason@redhat.com>
PR c++/37439
* pt.c (tsubst_copy) [PARM_DECL]: Don't abort if the parm has
DECL_CONTEXT set.
2008-09-09 Jakub Jelinek <jakub@redhat.com> 2008-09-09 Jakub Jelinek <jakub@redhat.com>
PR c++/37389 PR c++/37389
......
...@@ -9809,7 +9809,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl) ...@@ -9809,7 +9809,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
Replace it with an arbitrary expression with the same type Replace it with an arbitrary expression with the same type
(*(T*)0). This should only occur in an unevaluated context (*(T*)0). This should only occur in an unevaluated context
(i.e. decltype). */ (i.e. decltype). */
gcc_assert (skip_evaluation && DECL_CONTEXT (t) == NULL_TREE); gcc_assert (skip_evaluation);
r = non_reference (TREE_TYPE (t)); r = non_reference (TREE_TYPE (t));
r = tsubst (r, args, complain, in_decl); r = tsubst (r, args, complain, in_decl);
r = build_pointer_type (r); r = build_pointer_type (r);
......
...@@ -6,7 +6,10 @@ auto f() -> int ...@@ -6,7 +6,10 @@ auto f() -> int
} }
template<class T, class U> template<class T, class U>
auto add(T t, U u) -> decltype (t+u); auto add(T t, U u) -> decltype (t+u)
{
return t+u;
}
template<class T, class U> template<class T, class U>
decltype(T()+U()) add2(T t, U u); decltype(T()+U()) add2(T t, U u);
......
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