http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57136



             Bug #: 57136

           Summary: Should redeclaration of class template with function

                    pointer rather than function be an error?

    Classification: Unclassified

           Product: gcc

           Version: 4.8.0

            Status: UNCONFIRMED

          Severity: minor

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: kjw.c...@gmail.com





'g++ -std=c++11 -Wall' compiles this without complaint:



    template <void F(int)> class A;

    template <void (*F)(int)> class A;



    template <typename T, void F(T)> class B;

    template <typename T, void (*F)(T)> class B;



clang++ issues an error for the redeclaration of class

B, but not for the redeclaration of class A.  I filed

this as a bug at LLVM, where I was told that this is

correct, and that the rule is, if I understood it

correctly:



    If a template parameter depends on a previous

    template parameter, then it must be token-by-token

    equivalent in any redeclaration.



I simply filing here for informative purposes.  I have

not attempted to confirm this in the C++11

specification.

Reply via email to