[llvm-bugs] [Bug 50735] Missing optimization for member function with const attribute

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 23 04:33:55 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50735

Allen zhong <zhongyunde at tom.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |---
             Status|RESOLVED                    |REOPENED

--- Comment #5 from Allen zhong <zhongyunde at tom.com> ---
I reopen it as it is undefined behavior, see detail in the link

https://isocpp.org/wiki/faq/const-correctness#mutable-data-members

Please don't write saying version X of compiler Y on machine Z lets you change
a non-mutable member of a const object. I don’t care - it is illegal according
to the language and your code will probably fail on a different compiler or
even a different version (an upgrade) of the same compiler. Just say no. Use
mutable instead. Write code that is guaranteed to work, not code that doesn't
seem to break

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210623/6b07559d/attachment-0001.html>


More information about the llvm-bugs mailing list