[Bug c++/95789] [10/11 Regression] Const method is allowed to return non-const reference on template class
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Jun 21 09:03:40 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95789
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |10.2
CC| |jakub at gcc dot gnu.org
Summary|Const method is allowed to |[10/11 Regression] Const
|return non-const reference |method is allowed to return
|on template class |non-const reference on
| |template class
Keywords| |accepts-invalid
Last reconfirmed| |2020-06-21
Status|UNCONFIRMED |NEW
Known to fail| |10.1.0, 11.0
Ever confirmed|0 |1
Known to work| |9.3.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
struct B {
int n;
};
template <typename T>
struct A {
B& get() const { return f; }
B f;
};
int main() {
A<int> a;
a.f = {};
a.get().n = 10;
if (a.f.n != 0)
__builtin_abort();
}
Started with r10-7094
c++: Readd [LR]ROTATE_EXPR support to constexpr.c [PR94067]
Since r10-6527-gaaa26bf496a646778ac861aed124d960b5bf549f fold_for_warn
will perform maybe_constant_value even on some cp_fold produced trees and
so can include rotate exprs which were removed last fall from constexpr.c
2020-03-09 Jakub Jelinek <jakub@redhat.com>
PR c++/94067
Revert
2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
* constexpr.c (cxx_eval_constant_expression): Do not handle
RROTATE_EXPR and LROTATE_EXPR.
* g++.dg/warn/Wconversion-pr94067.C: New test.
More information about the Gcc-bugs
mailing list