[Bug c++/95789] [10/11 Regression] Const method is allowed to return non-const reference on template class
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jul 7 23:11:44 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95789
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Another test:
// PR c++/96104
template <typename T> void fn(T &);
class E {};
struct F {
template <typename T> void mfn(T t) { t, fn(E()); } // { dg-error "cannot
bind non-const lvalue reference" }
};
int
main()
{
E e;
F f;
f.mfn(e);
}
More information about the Gcc-bugs
mailing list