[Bug c++/71369] New: Compile failure about template function call operator

jkjeon at etri dot re.kr gcc-bugzilla@gcc.gnu.org
Wed Jun 1 09:39:00 GMT 2016


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

            Bug ID: 71369
           Summary: Compile failure about template function call operator
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jkjeon at etri dot re.kr
  Target Milestone: ---

Please see the following code:

struct Func {
        template <int t>
        void operator()() {}
};

template <int t, typename Functor>
void func(Functor functor) {
        functor.operator()<t>();
}

int main()
{
        func<3>(Func());
}


The gcc 6.1.0 can't compile this code.
On the other hand, the following code is compiled w/o any problem:

struct Func {
        template <int t>
        void operator()() {}
};

template <int t>
void func(Func functor) {
        functor.operator()<t>();
}

int main()
{
        func<3>(Func());
}

MSVC 2015 seems to compiles both of the codes successfully, while 
Clang suffers from the same problem.

Thank you.


More information about the Gcc-bugs mailing list