[Bug c++/102980] [10/11/12 Regression] Fail to get an r-value from std::array::size in a template function

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Oct 28 08:51:27 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |10.1.0
      Known to work|                            |9.1.0, 9.4.0
           Keywords|                            |needs-bisection
   Last reconfirmed|                            |2021-10-28
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed reduced self contained (no header) testcase:
struct a
{
  constexpr int size(void){return 0;}
};

template<class T>
int parse1() {
    a b;
    return int{b.size()};
}

Note the constexpr is important here.


More information about the Gcc-bugs mailing list