3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cpp \
8 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/b.cpp \
9 // RUN: -fmodule-file=A=%t/A.pcm -o %t/B.pcm
11 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/c.cpp \
12 // RUN: -fmodule-file=A=%t/A.pcm -o %t/C.pcm
14 // RUN: %clang_cc1 -std=c++20 -verify %t/main.cpp \
15 // RUN: -fmodule-file=A=%t/A.pcm \
16 // RUN: -fmodule-file=B=%t/B.pcm \
17 // RUN: -fmodule-file=C=%t/C.pcm
19 // expected-no-diagnostics
24 export consteval
const char *hello() { return "hello"; }
25 export
constexpr const char *helloA0
= hello();
26 export
constexpr const char *helloA1
= helloA0
;
27 export
constexpr const char *helloA2
= hello();
33 export
constexpr const char *helloB1
= helloA0
;
34 export
constexpr const char *helloB2
= hello();
40 export
constexpr const char *helloC1
= helloA1
;
41 export
constexpr const char *helloC2
= hello();
49 // These are valid: they refer to the same evaluation of the same constant.
50 static_assert(helloA0
== helloA1
);
51 static_assert(helloA0
== helloB1
);
52 static_assert(helloA0
== helloC1
);
54 // These refer to distinct evaluations, and so may or may not be equal.
55 static_assert(helloA1
== helloA2
); // expected-error {{}} expected-note {{unspecified value}}
56 static_assert(helloA1
== helloB2
); // expected-error {{}} expected-note {{unspecified value}}
57 static_assert(helloA1
== helloC2
); // expected-error {{}} expected-note {{unspecified value}}
58 static_assert(helloA2
== helloB2
); // expected-error {{}} expected-note {{unspecified value}}
59 static_assert(helloA2
== helloC2
); // expected-error {{}} expected-note {{unspecified value}}
60 static_assert(helloB2
== helloC2
); // expected-error {{}} expected-note {{unspecified value}}