This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]