public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/78609] invalid member's visibility detection in constexpr with arrays
       [not found] <bug-78609-4@http.gcc.gnu.org/bugzilla/>
@ 2021-07-23 20:15 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; only message in thread
From: pinskia at gcc dot gnu.org @ 2021-07-23 20:15 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-23 20:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-78609-4@http.gcc.gnu.org/bugzilla/>
2021-07-23 20:15 ` [Bug c++/78609] invalid member's visibility detection in constexpr with arrays pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).