This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/71679] New: gcc silently accepts parameter number mismatch in template redeclaration


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71679

            Bug ID: 71679
           Summary: gcc silently accepts parameter number mismatch in
                    template redeclaration
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

markus@x4 tmp % cat llvm.ii
namespace name {
template <int> struct A;
}
struct B {
  template <int, int> friend struct name::A;
};

markus@x4 tmp % icpc -c llvm.ii
llvm.ii(5): warning #549: too many template parameters -- does not match
previous declaration (declared at line 2)
    template <int, int> friend struct name::A;
                      ^
markus@x4 tmp % clang++ -c llvm.ii
llvm.ii:5:3: error: too many template parameters in template redeclaration
  template <int, int> friend struct name::A;
  ^~~~~~~~~~~~~~~~~~~
llvm.ii:2:1: note: previous template declaration is here
template <int> struct A;
^~~~~~~~~~~~~~
1 error generated.

markus@x4 tmp % g++ -Wall -Wextra -c llvm.ii
markus@x4 tmp %

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]