40 lines · cpp
1// RUN: rm -fR %t2// RUN: split-file %s %t3// RUN: cd %t4// RUN: %clang_cc1 -std=c++20 -fmodule-map-file=modules.map -xc++ -emit-module -fmodule-name=foo modules.map -o foo.pcm5// RUN: %clang_cc1 -std=c++20 -fmodule-map-file=modules.map -O1 -emit-obj main.cc -verify -fmodule-file=foo.pcm6 7//--- modules.map8module "foo" {9 export *10 module "foo.h" {11 export *12 header "foo.h"13 }14}15 16//--- foo.h17#pragma once18 19template <int>20void Create(const void* = nullptr);21 22template <int>23struct ObjImpl {24 template <int>25 friend void ::Create(const void*);26};27 28template <int I>29void Create(const void*) {30 (void) ObjImpl<I>{};31}32 33//--- main.cc34// expected-no-diagnostics35#include "foo.h"36 37int main() {38 Create<42>();39}40