[llvm-bugs] [Bug 41093] Clang looses constexpr.

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 16 17:33:14 PDT 2019


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

Richard Smith <richard-llvm at metafoo.co.uk> changed:

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

--- Comment #1 from Richard Smith <richard-llvm at metafoo.co.uk> ---
This is a GCC bug. This code:

constexpr void table_map_one_helper(const Table& t, OutTable& out_table, Op op)
{
  constexpr auto multi_s = t.math.template as_multi_s<idx>();
//...

is ill-formed, because the reference 't' cannot be used in a constant
expression (naming a reference resolves it to the referenced object, which is
unknown here).

You can fix your code by changing that to

  constexpr auto multi_s = decltype(t.math)::template as_multi_s<idx>();

https://gcc.godbolt.org/z/MBb1-9

-- 
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/20190317/6bfe05f6/attachment.html>


More information about the llvm-bugs mailing list