From: Paolo Carlini Date: Fri, 1 Aug 2014 19:59:56 +0000 (+0000) Subject: DR 217 again X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1d9e3db7e680c3a70c0d065fa587c14ddce72d5;p=gcc.git DR 217 again /cp 2014-08-01 Paolo Carlini DR 217 again * decl.c (duplicate_decls): Handle static member functions too. /testsuite 2014-08-01 Paolo Carlini DR 217 again * g++.dg/tc1/dr217-2.C: New. From-SVN: r213505 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6a4e57d0e6d..5d06ade76d6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2014-08-01 Paolo Carlini + + DR 217 again + * decl.c (duplicate_decls): Handle static member functions too. + 2014-08-01 Igor Zamyatin * cp-array-notation.c (expand_an_in_modify_expr): Fix the misprint diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fd5e2e5f3c5..4e4c589aac2 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -1706,14 +1706,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ; else if (TREE_CODE (olddecl) == FUNCTION_DECL) { - tree t1 = TYPE_ARG_TYPES (TREE_TYPE (olddecl)); - tree t2 = TYPE_ARG_TYPES (TREE_TYPE (newdecl)); + tree t1 = FUNCTION_FIRST_USER_PARMTYPE (olddecl); + tree t2 = FUNCTION_FIRST_USER_PARMTYPE (newdecl); int i = 1; - if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE) - t1 = TREE_CHAIN (t1), t2 = TREE_CHAIN (t2); - - if (TREE_CODE (TREE_TYPE (newdecl)) == METHOD_TYPE + if (DECL_FUNCTION_MEMBER_P (newdecl) && CLASSTYPE_TEMPLATE_INFO (CP_DECL_CONTEXT (newdecl))) { /* C++11 8.3.6/6. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1bf38ab4135..81b20e0763a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-08-01 Paolo Carlini + + DR 217 again + * g++.dg/tc1/dr217-2.C: New. + 2014-08-01 Igor Zamyatin PR other/61963 diff --git a/gcc/testsuite/g++.dg/tc1/dr217-2.C b/gcc/testsuite/g++.dg/tc1/dr217-2.C new file mode 100644 index 00000000000..75c40f8b209 --- /dev/null +++ b/gcc/testsuite/g++.dg/tc1/dr217-2.C @@ -0,0 +1,13 @@ +// { dg-do compile } +// DR217: Default arguments for non-template member functions of class +// templates + +template +struct S +{ + static void foo (int); +}; + +template +void S::foo (int = 0) // { dg-error "" "default arguments for parameters of member functions of class templates can be specified in the initial declaration only" } +{ }