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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-23
            Summary|invalid member's visibility |invalid member's visibility
                   |detection in constexpr      |detection in constexpr with
                   |                            |arrays
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.  The problem is with taking the address of a field and templates.
Here is a reduced testcase:
struct A
{
private:
        char data;
public:
        constexpr const char *c_str() const { return &data; }
        constexpr A(char const str) : data(str) {};
        constexpr A() : data()  {};
};
template<size_t>
struct B
{
        static const constexpr A name = A{'a'};
        static const constexpr char * value = name.c_str();
};
template<size_t I>
const constexpr A B<I>::name;

const char  *c = B<0>::value;

---- CUT ----
If I make B a non-template, then it will work correctly.

Reply via email to