| 1 |
// RUN: rm -rf %t |
| 2 |
// RUN: mkdir -p %t |
| 3 |
// RUN: split-file %s %t |
| 4 |
// |
| 5 |
// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-module-interface -o %t/bar.pcm |
| 6 |
// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify |
| 7 |
// |
| 8 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/bar.cppm -emit-module-interface \ |
| 9 |
// RUN: -o %t/bar.pcm |
| 10 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/foo.cc \ |
| 11 |
// RUN: -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify |
| 12 |
// |
| 13 |
// RUN: %clang_cc1 -std=c++20 %t/bar.cppm -emit-reduced-module-interface -o %t/bar.pcm |
| 14 |
// RUN: %clang_cc1 -std=c++20 %t/foo.cc -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify |
| 15 |
// |
| 16 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/bar.cppm -emit-reduced-module-interface \ |
| 17 |
// RUN: -o %t/bar.pcm |
| 18 |
// RUN: %clang_cc1 -std=c++20 -fskip-odr-check-in-gmf %t/foo.cc \ |
| 19 |
// RUN: -fmodule-file=bar=%t/bar.pcm -fsyntax-only -verify |
| 20 |
|
| 21 |
//--- h.hpp |
| 22 |
#pragma once |
| 23 |
|
| 24 |
struct T { |
| 25 |
constexpr T(const char *) {} |
| 26 |
}; |
| 27 |
template <char... c> |
| 28 |
struct t { |
| 29 |
inline constexpr operator T() const { return {s}; } |
| 30 |
|
| 31 |
private: |
| 32 |
inline static constexpr char s[]{c..., '\0'}; |
| 33 |
}; |
| 34 |
|
| 35 |
//--- bar.cppm |
| 36 |
module; |
| 37 |
#include "h.hpp" |
| 38 |
export module bar; |
| 39 |
export inline constexpr auto k = t<'k'>{}; |
| 40 |
|
| 41 |
//--- foo.cc |
| 42 |
// expected-no-diagnostics |
| 43 |
#include "h.hpp" |
| 44 |
import bar; |
| 45 |
void f() { |
| 46 |
T x = k; |
| 47 |
} |