gcc/testsuite/g++.dg/template/pr88795.C
raw| 1 | // { dg-do compile { target c++17 } } |
| 2 | |
| 3 | template<class, int> |
| 4 | struct Array {}; |
| 5 | |
| 6 | template<class T, int size_> |
| 7 | struct Foo { |
| 8 | static constexpr int size() { |
| 9 | return size_; |
| 10 | } |
| 11 | |
| 12 | template<class U> |
| 13 | Foo(U, Array<T, size()>) {} |
| 14 | }; |
| 15 | |
| 16 | template<class T, int size, class U> |
| 17 | Foo(U, Array<T, size>) -> Foo<T, size>; |
| 18 | |
| 19 | int main() { |
| 20 | Array<int, 2> arr{}; |
| 21 | |
| 22 | Foo foo{2.0, arr}; |
| 23 | } |