This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80456] calling constexpr member function from volatile-qualified member function: error: ‘this’ is not a constant expression
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 20 Apr 2017 13:32:02 +0000
- Subject: [Bug c++/80456] calling constexpr member function from volatile-qualified member function: error: ‘this’ is not a constant expression
- Auto-submitted: auto-generated
- References: <bug-80456-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80456
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org,
| |jason at gcc dot gnu.org
--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The test() call is represented as *(volatile struct A *) this, A::test () and
the *this dereference in that case is what triggers the error (well, this
itself).
This is created by:
8827 /* In an expression of the form `a->f()' where `f' turns
8828 out to be a static member function, `a' is
8829 none-the-less evaluated. */
8830 if (TREE_CODE (TREE_TYPE (fn)) != METHOD_TYPE
8831 && !is_dummy_object (instance)
8832 && TREE_SIDE_EFFECTS (instance))
8833 call = build2 (COMPOUND_EXPR, TREE_TYPE (call),
8834 instance, call);
So shall we have some exception of *this if it is volatile and still ignore it?