Commit 58cbf8d4 by Paolo Carlini Committed by Paolo Carlini

re PR c++/65370 (r213519 causes: error: redeclaration of 'template... may not…

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
parent 2d977ff9
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> 2015-03-10 Jakub Jelinek <jakub@redhat.com>
PR c++/65127 PR c++/65127
......
...@@ -1922,6 +1922,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend) ...@@ -1922,6 +1922,8 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
{ {
/* Per C++11 8.3.6/4, default arguments cannot be added in later /* Per C++11 8.3.6/4, default arguments cannot be added in later
declarations of a function template. */ declarations of a function template. */
if (DECL_SOURCE_LOCATION (newdecl)
!= DECL_SOURCE_LOCATION (olddecl))
check_redeclaration_no_default_args (newdecl); check_redeclaration_no_default_args (newdecl);
check_default_args (newdecl); check_default_args (newdecl);
......
2015-03-10 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/65370
* g++.dg/other/default11.C: New.
* g++.dg/other/default12.C: Likewise.
2015-03-10 Jakub Jelinek <jakub@redhat.com> 2015-03-10 Jakub Jelinek <jakub@redhat.com>
PR target/65368 PR target/65368
......
// PR c++/65370
template <typename> class C
{
template <typename U>
C(const C<U>&, bool = false);
};
template <>
template <typename U>
C<int>::C(const C<U>&, bool);
// PR c++/65370
template <typename> class C
{
template <typename U>
C(const C<U>&, bool = false);
};
template<>
class C<int>
{
template <typename U>
C(const C<U>&, bool);
};
template <typename U> C<int>::C(const C<U>&, bool = false) { } // { dg-error "default arguments" }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment