[Bug c++/91082] New: Reference to function binds to pointer to function when given a template specialization

david at doublewise dot net gcc-bugzilla@gcc.gnu.org
Thu Jul 4 04:53:00 GMT 2019


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

            Bug ID: 91082
           Summary: Reference to function binds to pointer to function
                    when given a template specialization
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: david at doublewise dot net
  Target Milestone: ---

In the following code, gcc accepts the code in `c`, but rejects the code in
`d`. I believe both should be rejected, because it is attempting to bind a
pointer to a reference.


template<typename>
void a();

void b();

void c() {
    static_cast<void(&)()>(&a<void>);
}

void d() {
    static_cast<void(&)()>(&b);
}




See it live: https://godbolt.org/z/zguy6D


More information about the Gcc-bugs mailing list