re PR c++/37766 ([C++0x] ICE with function's default reference template parameter)
PR c++/37766 * pt.c (type_unification_real): Call convert_template_argument for function default template arguments. (check_default_tmpl_args): Suggest -std=c++0x when function default template args seen in C++98 mode. From-SVN: r152685
This commit is contained in:
parent
610bf3ebef
commit
23f392e019
@ -1,3 +1,11 @@
|
||||
2009-10-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/37766
|
||||
* pt.c (type_unification_real): Call convert_template_argument
|
||||
for function default template arguments.
|
||||
(check_default_tmpl_args): Suggest -std=c++0x when function default
|
||||
template args seen in C++98 mode.
|
||||
|
||||
2009-10-11 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/37204
|
||||
|
11
gcc/cp/pt.c
11
gcc/cp/pt.c
@ -4025,7 +4025,8 @@ check_default_tmpl_args (tree decl, tree parms, int is_primary,
|
||||
else if (is_friend_decl)
|
||||
msg = "default template arguments may not be used in function template friend declarations";
|
||||
else if (TREE_CODE (decl) == FUNCTION_DECL && (cxx_dialect == cxx98))
|
||||
msg = "default template arguments may not be used in function templates";
|
||||
msg = ("default template arguments may not be used in function templates "
|
||||
"without -std=c++0x or -std=gnu++0x");
|
||||
else if (is_partial)
|
||||
msg = "default template arguments may not be used in partial specializations";
|
||||
else
|
||||
@ -13178,9 +13179,11 @@ type_unification_real (tree tparms,
|
||||
to explicitly check cxx_dialect here. */
|
||||
if (TREE_PURPOSE (TREE_VEC_ELT (tparms, i)))
|
||||
{
|
||||
tree arg = tsubst_template_arg
|
||||
(TREE_PURPOSE (TREE_VEC_ELT (tparms, i)),
|
||||
targs, tf_none, NULL_TREE);
|
||||
tree parm = TREE_VALUE (TREE_VEC_ELT (tparms, i));
|
||||
tree arg = TREE_PURPOSE (TREE_VEC_ELT (tparms, i));
|
||||
arg = tsubst_template_arg (arg, targs, tf_none, NULL_TREE);
|
||||
arg = convert_template_argument (parm, arg, targs, tf_none,
|
||||
i, NULL_TREE);
|
||||
if (arg == error_mark_node)
|
||||
return 1;
|
||||
else
|
||||
|
@ -1,3 +1,8 @@
|
||||
2009-10-12 Jason Merrill <jason@redhat.com>
|
||||
|
||||
PR c++/37766
|
||||
* g++.dg/cpp0x/fntmpdefarg1.C: New.
|
||||
|
||||
2009-10-12 Janis Johnson <janis187@us.ibm.com>
|
||||
|
||||
* gcc.dg/lto/20090914-2.c: Fix typos in test directives.
|
||||
|
7
gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C
Normal file
7
gcc/testsuite/g++.dg/cpp0x/fntmpdefarg1.C
Normal file
@ -0,0 +1,7 @@
|
||||
// PR c++/37766
|
||||
// { dg-options -std=c++0x }
|
||||
|
||||
int a = 1;
|
||||
template<int& b = a> void f() {
|
||||
f<>();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user