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

            Bug ID: 91678
           Summary: decltype returns wrong type under certain conditions
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mednafen at sent dot com
  Target Milestone: ---

I'm not totally sure this is a bug, but the following C++ code generates a
compilation error("invalid cast of an rvalue expression of type 'float*' to
type 'float*&'") in g++ 9.2:

float* test(float* c) { return (decltype(c + 0))(float*)c; }

whereas this does not:

float* test(float* c) { return (decltype(c + 0))c; }

Reply via email to