https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96716
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2020-08-20 Ever confirmed|0 |1 Keywords| |rejects-valid --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Reduced: struct string_view { constexpr string_view(const char* p) : p(p) { } const char* p; }; class Foo { public: constexpr string_view getfoo() const { return {&foo}; } private: const char foo = 'c'; }; inline constexpr Foo foo; template <typename> class Bar { public: static constexpr auto bar = foo.getfoo(); }; auto& baz = Bar<int>::bar; pr96716.C: In instantiation of 'constexpr const string_view Bar<int>::bar': pr96716.C:24:23: required from here pr96716.C:21:25: error: 'const char Foo::foo' is private within this context 21 | static constexpr auto bar = foo.getfoo(); | ^~~ pr96716.C:13:14: note: declared private here 13 | const char foo = 'c'; | ^~~