[Bug c++/96716] GCC reports "object is private" when it's accessed through proper accessor
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Aug 20 08:09:06 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96716
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Slightly further reduced:
struct string_view
{
constexpr string_view(const char* p) : p(p) { }
const char* p;
};
struct Foo {
constexpr string_view getfoo() const {
return {&foo};
}
private:
const char foo = 'c';
};
inline constexpr Foo foo;
template <typename>
struct Bar {
static constexpr auto bar = foo.getfoo();
};
auto& baz = Bar<int>::bar;
More information about the Gcc-bugs
mailing list