[LoopVectorizer] Add support for chaining partial reductions (#120272)
[llvm-project.git] / clang / test / Modules / string-literal-uniqueness.cpp
blob34adc2b0303bdf5185aeb71fa4a7802d79879fcb
1 // RUN: rm -rf %t
2 // RUN: mkdir -p %t
3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/a.cpp \
6 // RUN: -o %t/A.pcm
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
21 //--- a.cpp
23 export module A;
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();
29 //--- b.cpp
31 export module B;
32 import A;
33 export constexpr const char *helloB1 = helloA0;
34 export constexpr const char *helloB2 = hello();
36 //--- c.cpp
38 export module C;
39 import A;
40 export constexpr const char *helloC1 = helloA1;
41 export constexpr const char *helloC2 = hello();
43 //--- main.cpp
45 import A;
46 import B;
47 import C;
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}}