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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]

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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to