[llvm-bugs] [Bug 48027] New: -Winvalid-constexpr fails to warn when calling non-constexpr method on field

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Oct 30 15:02:27 PDT 2020


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

            Bug ID: 48027
           Summary: -Winvalid-constexpr fails to warn when calling
                    non-constexpr method on field
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: comexk at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

The below should warn that y() can never be constant evaluated, but fails to as
of current trunk.  Either of the following changes will restore the warning:

- Changing `void x()` to `static void x()`
- Changing `constexpr void y()` to `constexpr void y(X x)`

struct X {
    void x();
};
struct Y {
    X x;
    constexpr void y() { x.x(); }
};

-- 
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/20201030/ee5374ca/attachment.html>


More information about the llvm-bugs mailing list