| 1 |
// RUN: rm -fR %t |
| 2 |
// RUN: split-file %s %t |
| 3 |
// RUN: cd %t |
| 4 |
// RUN: %clang_cc1 -std=c++20 -fmodule-map-file=modules.map -xc++ -emit-module -fmodule-name=foo modules.map -o foo.pcm |
| 5 |
// RUN: %clang_cc1 -std=c++20 -fmodule-map-file=modules.map -O1 -emit-obj main.cc -verify -fmodule-file=foo.pcm |
| 6 |
|
| 7 |
//--- modules.map |
| 8 |
module "foo" { |
| 9 |
export * |
| 10 |
module "foo.h" { |
| 11 |
export * |
| 12 |
header "foo.h" |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
//--- foo.h |
| 17 |
#pragma once |
| 18 |
|
| 19 |
template <int> |
| 20 |
void Create(const void* = nullptr); |
| 21 |
|
| 22 |
template <int> |
| 23 |
struct ObjImpl { |
| 24 |
template <int> |
| 25 |
friend void ::Create(const void*); |
| 26 |
}; |
| 27 |
|
| 28 |
template <int I> |
| 29 |
void Create(const void*) { |
| 30 |
(void) ObjImpl<I>{}; |
| 31 |
} |
| 32 |
|
| 33 |
//--- main.cc |
| 34 |
// expected-no-diagnostics |
| 35 |
#include "foo.h" |
| 36 |
|
| 37 |
int main() { |
| 38 |
Create<42>(); |
| 39 |
} |