47 lines · plain
1// Tests that the compiler won't crash due to the consteval constructor.2//3// REQUIRES: x86-registered-target4//5// RUN: rm -rf %t6// RUN: mkdir -p %t7// RUN: split-file %s %t8//9// RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++20 -emit-module-interface %t/m.cppm -o %t/m.pcm10// RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++20 %t/m.pcm -emit-llvm -o - | FileCheck %t/m.cppm11 12//--- m.cppm13module;14#include "fail.h"15export module mymodule;16 17// CHECK: @.str = {{.*}}"{}\00"18// CHECK: store{{.*}}ptr @.str19 20//--- fail.h21namespace std { 22 23template<class _CharT>24class basic_string_view {25public:26 constexpr basic_string_view(const _CharT* __s)27 : __data_(__s) {}28 29private:30 const _CharT* __data_;31};32 33template <class _CharT>34struct basic_format_string {35 template <class _Tp>36 consteval basic_format_string(const _Tp& __str) : __str_{__str} {37 }38 39private:40 basic_string_view<_CharT> __str_;41};42}43 44auto this_fails() -> void {45 std::basic_format_string<char> __fmt("{}");46}47