Debian Codegraph @

gcc/testsuite/g++.dg/modules/dguide-3_d.C

raw
1 // { dg-additional-options "-fmodules-ts" }
2 // Test merging deduction guides.
3
4 template <typename T> struct S {
5 template <typename U> S(U);
6 };
7
8 import A;
9 import B;
10 import C;
11
12 int main() {
13 // declared in A and B
14 S x(123);
15 S<int> x2 = x;
16
17 // declared only in A
18 S y(0.5);
19 S<double> y2 = y;
20
21 // declared only in B
22 S z('c');
23 S<char> z2 = z;
24
25 // declared only in C (and attached to named module)
26 S w("hello");
27 S<const char*> w2 = w;
28 }
29
30 S(char) -> S<double>; // { dg-error "ambiguating" }