[Bug c++/69098] New: Member function template flagged with 'is not a function template'

Hireve@trash-mail.com gcc-bugzilla@gcc.gnu.org
Thu Dec 31 05:38:00 GMT 2015


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

            Bug ID: 69098
           Summary: Member function template flagged with 'is not a
                    function template'
           Product: gcc
           Version: unknown
               URL: http://melpon.org/wandbox/permlink/DShqHOBBMDx3X0H2
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Hireve@trash-mail.com
  Target Milestone: ---

GCC HEAD on Wandbox rejects the code I pasted below, while Clang accepts it
without errors. Link: http://melpon.org/wandbox/permlink/DShqHOBBMDx3X0H2

I also have a local TDM-GCC 5.1.0 (DW2) installation which gives the same error
message for my original code, but for some reason the bug doesn’t trigger on
Wandbox’s 5.1.0 with the minimal testcase I’ve extracted.

/*-- Code --*/
template<typename> struct SpecPerType;

class Specializer
{
public:
    template<bool> void MbrFnTempl() //Must be a template
        {
        }
        template<unsigned> struct InnerClassTempl
        {  //Had to be a template whenever I tested for it
                static void InnerMemberFn();
        };

        void Trigger()
        {
                InnerClassTempl<0u>::InnerMemberFn();
        }
};

template<> struct SpecPerType<Specializer>
{
        using FnType = void (Specializer::*)();
    template<bool P> static constexpr FnType SpecMbrFnPtr =
        &Specializer::template MbrFnTempl<P>;
};

template<bool> constexpr SpecPerType<Specializer>::FnType
    SpecPerType<Specializer>::SpecMbrFnPtr; //Just a formalism

template<unsigned X> void Specializer::InnerClassTempl<X>::InnerMemberFn()
{
        using Spec = SpecPerType<Specializer>;
        typename Spec::FnType ErrorSite = Spec::template SpecMbrFnPtr<true>;
    //ErrorSite would get called next in the original code
    //(this should result in a call to MbrFnTempl)
}

int main()
{
}


More information about the Gcc-bugs mailing list