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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.5
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96716
            Summary|Weird error message about   |[10/11/12/13 Regression]
                   |accessing a private member  |Weird error message about
                   |of my own class inside of   |accessing a private member
                   |std::string_view inside of  |of my own class inside of
                   |constexpr                   |std::string_view inside of
                   |                            |constexpr
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Here's a reduced C++11 testcase that became rejects-valid after
r10-6416-g8fda2c274ac66d:

struct A {
  constexpr const int* get() const { return &m; }
private:
  int m = 42;
} a;

struct B { const int* p; };

template<class>
void f() {
  constexpr B b = {a.get()};
}

template void f<int>();

<stdin>: In function ‘void f()’:
<stdin>:11:25: error: ‘int A::m’ is private within this context
<stdin>:4:7: note: declared private here
<stdin>: In instantiation of ‘void f() [with <template-parameter-1-1> = int]’:
<stdin>:14:22:   required from here
<stdin>:11:25: error: ‘int A::m’ is private within this context
<stdin>:4:7: note: declared private here

Reply via email to