aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2015-03-10 22:20:41 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2015-03-10 22:20:41 +0000
commit58cbf8d4dcaa6d0d81cd94bc3e8001b419265dd0 (patch)
treecf5ced19b7d49227299751b10fdc0edf1b11b546 /gcc/cp
parent2d977ff983f86b3f7b7c9f1cb5a479af75cd589e (diff)
downloadgcc-58cbf8d4dcaa6d0d81cd94bc3e8001b419265dd0.zip
gcc-58cbf8d4dcaa6d0d81cd94bc3e8001b419265dd0.tar.gz
gcc-58cbf8d4dcaa6d0d81cd94bc3e8001b419265dd0.tar.bz2
re PR c++/65370 (r213519 causes: error: redeclaration of 'template... may not have default arguments [-fpermissive])
/cp 2015-03-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/65370 * decl.c (duplicate_decls): Call check_redeclaration_no_default_args only if the location of newdecl doesn't match the location of olddecl. /testsuite 2015-03-10 Paolo Carlini <paolo.carlini@oracle.com> PR c++/65370 * g++.dg/other/default11.C: New. * g++.dg/other/default12.C: Likewise. From-SVN: r221337
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 1202b0f..625b034 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-10 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/65370
+ * decl.c (duplicate_decls): Call check_redeclaration_no_default_args
+ only if the location of newdecl doesn't match the location of olddecl.
+
2015-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/65127
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 83e060b..54e6418 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1922,7 +1922,9 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{
/* Per C++11 8.3.6/4, default arguments cannot be added in later
declarations of a function template. */
- check_redeclaration_no_default_args (newdecl);
+ if (DECL_SOURCE_LOCATION (newdecl)
+ != DECL_SOURCE_LOCATION (olddecl))
+ check_redeclaration_no_default_args (newdecl);
check_default_args (newdecl);