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

            Bug ID: 91051
           Summary: [9 Regression] Template conversion operator don't
                    match when converting to constant rvalue reference
           Product: gcc
           Version: 9.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gufideg at gmail dot com
  Target Milestone: ---

The following code was compiling in older GCC version, but don't compile with
GCC 9.1:

    struct probe {
        template<typename T>
        operator T const&& ();
    };

    void frob(int const&) {}

    int main() {
        frob(probe()); // don't work with GCC 9.1
    }

The expected result is the template conversion operator to rvalue reference to
constant to be called, then binding to the lvalue reference to constant.

This bug don't apply to non templated conversion operator:

    struct probe {
        operator int const&& ();
    };

    void frob(int const&) {}

    int main() {
        frob(probe()); // works under GCC 9.1
    }

Reply via email to