[llvm-bugs] [Bug 32424] New: __builtin_assume: constexpr conversion to bool "has side effects"

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 25 14:14:49 PDT 2017


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

            Bug ID: 32424
           Summary: __builtin_assume: constexpr conversion to bool "has
                    side effects"
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Casey at Carter.net
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Created attachment 18171
  --> https://bugs.llvm.org/attachment.cgi?id=18171&action=edit
Minimal repro

This program:

  struct S {
    static constexpr bool value = false;
    constexpr operator bool () const noexcept { return value; }
  };

  int main() { __builtin_assume(S()); }

compiled with "-std=c++11 -Wassume" incorrectly diagnoses:

  prog.cc:6:31: warning: the argument to '__builtin_assume' has side effects
that will be discarded [-Wassume]
  int main() { __builtin_assume(S()); }
                                ^~~

(See https://wandbox.org/permlink/yBxuUORdvKQYf5Ri)

-- 
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/20170325/c5b67728/attachment.html>


More information about the llvm-bugs mailing list