[llvm-bugs] [Bug 43990] New: Incorrect error on static_assert expression

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 13 07:52:09 PST 2019


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

            Bug ID: 43990
           Summary: Incorrect error on static_assert expression
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pkeir at outlook.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

Created attachment 22806
  --> https://bugs.llvm.org/attachment.cgi?id=22806&action=edit
Code to produce the issue described.

The C++11 code below produces a compilation error stating that the
static_assert expression is not an integral constant expression. GCC trunk
compiles this. Commenting-out the static assert removes the error.

template <typename T>
constexpr bool bar(T &)  { return true; }

template <typename T>
constexpr bool foo(T &x) { static_assert(bar(x),""); return bar(x); }

int main(int argc, char *argv[])
{
  int i;
  constexpr bool x = foo(i);
  return 0;
}

-- 
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/20191113/1a81d2bd/attachment.html>


More information about the llvm-bugs mailing list