[Bug c++/11827] New: No diagnostics for multiple decls with default arguments if template
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Aug 6 09:18:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11827
Summary: No diagnostics for multiple decls with default arguments
if template
Product: gcc
Version: 3.3.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jakub at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
g++ only pedwarns about bar but not foo in the following testcase:
template<typename _Tv> int foo (int x = -1);
template<typename _Tv> int foo (int x = -1)
{
return 0;
}
int bar (int x = -1);
int bar (int x = -1)
{
return 0;
}
int i = foo<int> ();
int j = bar ();
The warning could be emitted after:
--- cp/decl.c.xx 2003-08-05 18:41:19.000000000 -0400
+++ cp/decl.c 2003-08-06 05:07:46.000000000 -0400
@@ -3150,9 +3150,7 @@ duplicate_decls (tree newdecl, tree oldd
}
}
- if (DECL_LANG_SPECIFIC (olddecl) && DECL_USE_TEMPLATE (olddecl))
- ;
- else if (TREE_CODE (olddecl) == FUNCTION_DECL)
+ if (TREE_CODE (olddecl) == FUNCTION_DECL)
{
tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl));
tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl));
but I wonder whether instantiation is the proper time when the pedwarn
should be issued (and not already when duplicate_decls sees template_decl).
More information about the Gcc-bugs
mailing list