re PR c++/15867 (-Wredundant-decls and explicit template specialization)
/cp 2012-01-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/15867 * decl.c (duplicate_decls): With -Wredundant-decls don't warn for declaration followed by specialization. /testsuite 2012-01-03 Paolo Carlini <paolo.carlini@oracle.com> PR c++/15867 * g++.dg/warn/Wredundant-decls-spec.C: New. From-SVN: r182833
This commit is contained in:
parent
a973020052
commit
da89f7f38e
4 changed files with 27 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
2012-01-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/15867
|
||||
* decl.c (duplicate_decls): With -Wredundant-decls don't warn for
|
||||
declaration followed by specialization.
|
||||
|
||||
2012-01-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR c++/51669
|
||||
|
|
|
@ -1698,7 +1698,10 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
|
|||
/* Don't warn about extern decl followed by definition. */
|
||||
&& !(DECL_EXTERNAL (olddecl) && ! DECL_EXTERNAL (newdecl))
|
||||
/* Don't warn about friends, let add_friend take care of it. */
|
||||
&& ! (newdecl_is_friend || DECL_FRIEND_P (olddecl)))
|
||||
&& ! (newdecl_is_friend || DECL_FRIEND_P (olddecl))
|
||||
/* Don't warn about declaration followed by specialization. */
|
||||
&& (! DECL_TEMPLATE_SPECIALIZATION (newdecl)
|
||||
|| DECL_TEMPLATE_SPECIALIZATION (olddecl)))
|
||||
{
|
||||
warning (OPT_Wredundant_decls, "redundant redeclaration of %qD in same scope", newdecl);
|
||||
warning (OPT_Wredundant_decls, "previous declaration of %q+D", olddecl);
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2012-01-03 Paolo Carlini <paolo.carlini@oracle.com>
|
||||
|
||||
PR c++/15867
|
||||
* g++.dg/warn/Wredundant-decls-spec.C: New.
|
||||
|
||||
2012-01-03 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/51719
|
||||
|
|
12
gcc/testsuite/g++.dg/warn/Wredundant-decls-spec.C
Normal file
12
gcc/testsuite/g++.dg/warn/Wredundant-decls-spec.C
Normal file
|
@ -0,0 +1,12 @@
|
|||
// PR c++/15867
|
||||
// { dg-options -Wredundant-decls }
|
||||
|
||||
template <typename T> struct S
|
||||
{
|
||||
void foo() {}
|
||||
};
|
||||
|
||||
template<> void S<int>::foo();
|
||||
|
||||
template<> void S<double>::foo(); // { dg-warning "previous declaration" }
|
||||
template<> void S<double>::foo(); // { dg-warning "redundant redeclaration" }
|
Loading…
Add table
Reference in a new issue