Bug 11827 - No diagnostics for multiple decls with default arguments if template
Summary: No diagnostics for multiple decls with default arguments if template
Status: RESOLVED DUPLICATE of bug 11540
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-08-06 09:18 UTC by Jakub Jelinek
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Jelinek 2003-08-06 09:18:26 UTC
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).
Comment 1 Wolfgang Bangerth 2003-08-06 14:35:36 UTC
This is a duplicate of 11540.
W.

*** This bug has been marked as a duplicate of 11540 ***