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

            Bug ID: 77474
           Summary: sizeof and function template don't work properly
                    together
           Product: gcc
           Version: 6.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: michele.caini at gmail dot com
  Target Milestone: ---

The following code compiles:

    void f() { }

    int main() {
        sizeof(&f);
    }

The following does not instead:

    template<typename T>
    void f() { }

    int main() {
        sizeof(&f<int>);
    }

The error returned is:

    error: address of overloaded function with no contextual type information

According to expr.sizeof, both of them should compile.

Reply via email to