3 // RUN: split-file %s %t
5 // RUN: %clang_cc1 -std=c++20 %t/std-10-4-ex2-interface.cppm -emit-reduced-module-interface \
6 // RUN: -o %t/M.pcm -Wno-unused-value
7 // RUN: %clang_cc1 -std=c++20 %t/std-10-4-ex2-implementation.cpp -fmodule-file=M=%t/M.pcm \
8 // RUN: -fsyntax-only -verify -Wno-unused-value
16 inline int f(X, int = d()) { return e(); }
21 //--- std-10-4-ex2-interface.cppm
23 #include "std-10-4-ex2.h"
26 template <typename T> int use_f() {
27 N::X x; // N::X, N, and :: are decl-reachable from use_f
28 return f(x, 123); // N::f is decl-reachable from use_f,
29 // N::e is indirectly decl-reachable from use_f
30 // because it is decl-reachable from N::f, and
31 // N::d is decl-reachable from use_f
32 // because it is decl-reachable from N::f
33 // even though it is not used in this call
36 template <typename T> int use_g() {
37 N::X x; // N::X, N, and :: are decl-reachable from use_g
38 return g((T(), x)); // N::g is not decl-reachable from use_g
41 template <typename T> int use_h() {
42 N::X x; // N::X, N, and :: are decl-reachable from use_h
43 return h((T(), x)); // N::h is not decl-reachable from use_h, but
44 // N::h is decl-reachable from use_h<int>
48 // use_h<int> is decl-reachable from k, so
49 // N::h is decl-reachable from k
51 //--- std-10-4-ex2-implementation.cpp
56 // expected-error@std-10-4-ex2-interface.cppm:17 {{use of undeclared identifier 'g'}}
57 // expected-note@-2 {{in instantiation of function template specialization 'use_g<int>' requested here}}