comparison clang/test/Modules/pr58716.cppm @ 252:1f2b6ac9f198 llvm-original

LLVM16-1
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Fri, 18 Aug 2023 09:04:13 +0900
parents
children
comparison
equal deleted inserted replaced
237:c80f45b162ad 252:1f2b6ac9f198
1 // Tests that the compiler won't crash due to the consteval constructor.
2 //
3 // REQUIRES: x86-registered-target
4 //
5 // RUN: rm -rf %t
6 // RUN: mkdir -p %t
7 // RUN: split-file %s %t
8 //
9 // RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++20 -emit-module-interface %t/m.cppm -o %t/m.pcm
10 // RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++20 %t/m.pcm -S -emit-llvm -o - | FileCheck %t/m.cppm
11 //
12 //--- m.cppm
13 module;
14 #include "fail.h"
15 export module mymodule;
16
17 // CHECK: @.str = {{.*}}"{}\00"
18 // CHECK: store{{.*}}ptr @.str
19
20 //--- fail.h
21 namespace std {
22
23 template<class _CharT>
24 class basic_string_view {
25 public:
26 constexpr basic_string_view(const _CharT* __s)
27 : __data_(__s) {}
28
29 private:
30 const _CharT* __data_;
31 };
32
33 template <class _CharT>
34 struct basic_format_string {
35 template <class _Tp>
36 consteval basic_format_string(const _Tp& __str) : __str_{__str} {
37 }
38
39 private:
40 basic_string_view<_CharT> __str_;
41 };
42 }
43
44 auto this_fails() -> void {
45 std::basic_format_string<char> __fmt("{}");
46 }