diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/pt.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr79361-1.C | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr79361-2.C | 7 |
5 files changed, 32 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fb17a19..d747022 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2017-02-23 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/79361 + * pt.c (register_specialization): Check duplicate_decls return value + for error_mark_node and pass it back. + 2017-02-22 Jason Merrill <jason@redhat.com> PR c++/79679 - missing destructor for argument diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 17175ba..aaca70f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -1599,7 +1599,12 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend, } else if (DECL_TEMPLATE_SPECIALIZATION (fn)) { - if (!duplicate_decls (spec, fn, is_friend) && DECL_INITIAL (spec)) + tree dd = duplicate_decls (spec, fn, is_friend); + if (dd == error_mark_node) + /* We've already complained in duplicate_decls. */ + return error_mark_node; + + if (dd == NULL_TREE && DECL_INITIAL (spec)) /* Dup decl failed, but this is a new definition. Set the line number so any errors match this new definition. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 96a0234..6efe58d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-02-23 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/79361 + * g++.dg/cpp0x/pr79361-1.C: New. + * g++.dg/cpp0x/pr79361-2.C: Likewise. + 2017-02-23 Eric Botcazou <ebotcazou@adacore.com> * gcc.target/visium/bit_test.c: Accept any lsr form. diff --git a/gcc/testsuite/g++.dg/cpp0x/pr79361-1.C b/gcc/testsuite/g++.dg/cpp0x/pr79361-1.C new file mode 100644 index 0000000..2960067 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr79361-1.C @@ -0,0 +1,7 @@ +// PR c++/79361 +// { dg-do compile { target c++11 } } + +template<typename T> void foo(T); + +template<> void foo<int>(int) {} // { dg-message "declared" } +template<> void foo<int>(int) = delete; // { dg-error "redefinition" } diff --git a/gcc/testsuite/g++.dg/cpp0x/pr79361-2.C b/gcc/testsuite/g++.dg/cpp0x/pr79361-2.C new file mode 100644 index 0000000..2556211 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr79361-2.C @@ -0,0 +1,7 @@ +// PR c++/79361 +// { dg-do compile { target c++11 } } + +template<typename T> void foo(T); + +template<> void foo<int>(int) {} // { dg-message "declared" } +template<> void foo<int>(int) = default; // { dg-error "redefinition" } |