59 lines · plain
1// RUN: rm -rf %t2// RUN: split-file %s %t3//4// RUN: %clang_cc1 -std=c++20 %t/a.cppm -emit-reduced-module-interface -o %t/a.pcm5// RUN: %clang_cc1 -std=c++20 %t/b.cppm -emit-reduced-module-interface -o %t/b.pcm -fprebuilt-module-path=%t6// RUN: %clang_cc1 -std=c++20 %t/c.cppm -emit-reduced-module-interface -o %t/c.pcm -fprebuilt-module-path=%t7// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -fsyntax-only -verify8// RUN: %clang_cc1 -std=c++20 %t/d.cpp -fprebuilt-module-path=%t -fsyntax-only -verify -fexperimental-new-constant-interpreter9 10//--- a.h11template <typename T>12struct A {13 static const T value0;14 static const T value1;15 16 constexpr T get0() {17 return value0;18 }19 20 constexpr T get1() {21 return value1;22 }23};24 25template <typename T>26const T A<T>::value0 = T(43);27template <typename T>28const T A<T>::value1 = T(44);29 30//--- a.cppm31module;32#include "a.h"33export module a;34export using ::A;35 36//--- b.cppm37export module b;38export import a;39 40export constexpr int bar() {41 return A<int>().get0();42}43 44//--- c.cppm45export module c;46export import b;47 48export constexpr int foo() {49 return A<int>().get1() + A<int>().get0();50}51 52//--- d.cpp53// expected-no-diagnostics54 55import c;56 57static_assert(bar() + foo() == 130);58 59