Chuanqi Xu 303f20a2ca [C++20] [Modules] [Serialization] Deserialize
LValuePathSerializationHelper's type properly

Close https://github.com/llvm/llvm-project/issues/58716.

Tested with libcxx's modules build.

When we read the type of
LValuePathSerializationHelper, we didn't read the correct type. We read
the element type as its name suggests. But the problem here is that it
looks like that both the usage and serialization use its type as the
top level type. So here is the mismatch.

Actually, the type of LValuePathSerializationHelper is never used after
Deserialization without the assertion. So it doesn't matter for the
release users. And this patch shouldn't change the behavior too.

Reviewed By: erichkeane

Differential Revision: https://reviews.llvm.org/D139406
2022-12-07 10:52:02 +08:00

47 lines
1002 B
C++

// Tests that the compiler won't crash due to the consteval constructor.
//
// REQUIRES: x86-registered-target
//
// RUN: rm -rf %t
// RUN: mkdir -p %t
// RUN: split-file %s %t
//
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++20 -emit-module-interface %t/m.cppm -o %t/m.pcm
// RUN: %clang_cc1 -triple=x86_64-linux-gnu -std=c++20 %t/m.pcm -S -emit-llvm -o - | FileCheck %t/m.cppm
//
//--- m.cppm
module;
#include "fail.h"
export module mymodule;
// CHECK: @.str = {{.*}}"{}\00"
// CHECK: store{{.*}}ptr @.str
//--- fail.h
namespace std {
template<class _CharT>
class basic_string_view {
public:
constexpr basic_string_view(const _CharT* __s)
: __data_(__s) {}
private:
const _CharT* __data_;
};
template <class _CharT>
struct basic_format_string {
template <class _Tp>
consteval basic_format_string(const _Tp& __str) : __str_{__str} {
}
private:
basic_string_view<_CharT> __str_;
};
}
auto this_fails() -> void {
std::basic_format_string<char> __fmt("{}");
}