[Bug c++/77474] New: sizeof and function template don't work properly together

michele.caini at gmail dot com gcc-bugzilla@gcc.gnu.org
Sun Sep 4 18:10:00 GMT 2016


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.


More information about the Gcc-bugs mailing list