[llvm-bugs] [Bug 49742] New: Constexpr variable template constructor initializing flexible array member crashes compiler

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 27 10:38:24 PDT 2021


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

            Bug ID: 49742
           Summary: Constexpr variable template constructor initializing
                    flexible array member crashes compiler
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: matthewjbarichello at gmail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

Created attachment 24699
  --> https://bugs.llvm.org/attachment.cgi?id=24699&action=edit
Compiler crash backtrace

See attachment for compiler backtrace.

Affected versions:
Note: The issue seems to have been fixed in trunk already.
 - 11.0.1
 - 11.0.0
 - 10.0.1
 - 10.0.0
 - 9.0.1
 - 9.0.0
 - 8.0.1
 - 8.0.0
 - 7.1.0
 - 7.0.0

Driver cmdline:
Note: For versions that do not support -std=c++20, -std=c++2a was used.

clang++ -Xclang -disable-llvm-passes -std=c++20

Note: The original code has been reduced with creduce.
Reduced code:

struct a {
  int b[];
  template <typename... c> constexpr a(c... e) : b{e...} {}
};
int main() { constexpr a d{4}; }


Original code:

template<typename T>
struct S {
 T t[];

 template<typename... Args>
 constexpr S(Args... args) noexcept :
  t{args...}
 {}
};

int main() {
 constexpr const S<int> s{1, 2, 3, 4};
}

-- 
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/20210327/a5f641a9/attachment.html>


More information about the llvm-bugs mailing list