48 lines · plain
1// RUN: rm -rf %t2// RUN: mkdir -p %t3// RUN: split-file %s %t4//5// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-module-interface -o %t/bar.pcm6// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify7//8// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/bar.cppm -emit-module-interface \9// RUN: -o %t/bar.pcm10// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/foo.cc \11// RUN: -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify12//13// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-reduced-module-interface -o %t/bar.pcm14// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify15//16// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/bar.cppm -emit-reduced-module-interface \17// RUN: -o %t/bar.pcm18// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/foo.cc \19// RUN: -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify20 21//--- h.hpp22#pragma once23 24struct T {25 constexpr T(const char *) {}26};27template <char... c>28struct t {29 inline constexpr operator T() const { return {s}; }30 31private:32 inline static constexpr char s[]{c..., '\0'};33};34 35//--- bar.cppm36module;37#include "h.hpp"38export module bar;39export inline constexpr auto k = t<'k'>{};40 41//--- foo.cc42// expected-no-diagnostics43#include "h.hpp"44import bar;45void f() {46 T x = k;47}48