blob: 7f876b762afe1418f8c4ea7b0183095ac04ab697 [file] [log] [blame]
Richard Smith0b70de12018-06-28 01:07:28 +00001// RUN: %clang_cc1 -fmodules %s -verify
2// expected-no-diagnostics
3#pragma clang module build A
4module A {}
5#pragma clang module contents
6#pragma clang module begin A
7template<typename T> struct ct { friend auto operator-(ct, ct) { struct X {}; return X(); } void x(); };
8#pragma clang module end
9#pragma clang module endbuild
10
11#pragma clang module build B
12module B {}
13#pragma clang module contents
14#pragma clang module begin B
15template<typename T> struct ct { friend auto operator-(ct, ct) { struct X{}; return X(); } void x(); };
16inline auto f() { return ct<float>() - ct<float>(); }
17#pragma clang module end
18#pragma clang module endbuild
19
20// Force the definition of ct in module A to be the primary definition.
21#pragma clang module import A
22template<typename T> void ct<T>::x() {}
23
24// Attempt to cause the definition of operator- in the ct primary template in
25// module B to be the primary definition of that function. If that happens,
26// we'll be left with a class template ct that appears to not contain a
27// definition of the inline friend function.
28#pragma clang module import B
29auto v = f();
30
31ct<int> make();
32void h() {
33 make() - make();
34}