40 lines · cpp
1// RUN: %clang_cc1 -fmodules -std=c++17 -verify %s2// RUN: %clang_cc1 -fmodules -std=c++17 -verify %s -DLOCAL3// expected-no-diagnostics4 5#pragma clang module build A6module A {}7#pragma clang module contents8#pragma clang module begin A9inline auto f() { struct X {}; return X(); }10inline auto a = f();11auto g(int);12template<typename T> auto h(T t) { return g(t); }13#pragma clang module end14#pragma clang module endbuild15 16#pragma clang module build B17module B {}18#pragma clang module contents19#pragma clang module begin B20inline auto f() { struct X {}; return X(); }21inline auto b = f();22auto g(int) { return 0; }23#pragma clang module end24#pragma clang module endbuild25 26#ifdef LOCAL27inline auto f() { struct X {}; return X(); }28inline auto b = f();29auto g(int) { return 0; }30#else31#pragma clang module import B32#endif33 34#pragma clang module import A35 36using T = decltype(a);37using T = decltype(b);38 39int test_g = h(0);40