40 lines · cpp
1// RUN: rm -rf %t2// RUN: split-file %s %t3// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -I%t \4// RUN: -Wundefined-func-template \5// RUN: -fimplicit-module-maps %t/main.cpp 2>&1 | grep "unreachable declaration of template entity is here"6 7// Note that the diagnostics are triggered when building the 'hoge' module, which is imported from the main file.8// The "-verify" flag doesn't work in this case. Instead, we grep the expected text to verify the test.9 10//--- shared_ptr2.h11#pragma once12 13template<class T>14void x() { }15 16//--- hoge.h17#pragma once18 19#include "shared_ptr2.h"20 21inline void f() {22 x<int>();23}24 25//--- module.modulemap26module hoge {27 header "hoge.h"28}29 30module shared_ptr2 {31 header "shared_ptr2.h"32}33 34//--- main.cpp35#include "hoge.h"36 37int main() {38 f();39}40