C++: Add more deduction guide tests

This commit is contained in:
Jeroen Ketema
2024-08-02 14:12:56 +02:00
parent 4dcf67940c
commit 972d9ca2b8
6 changed files with 13 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
import cpp
from DeductionGuide d
where not exists(d.getTemplateClass())
select d

View File

@@ -0,0 +1,5 @@
| file://:0:0:0:0 | C | test.cpp:4:8:4:8 | C<T> |
| file://:0:0:0:0 | C | test.cpp:4:8:4:8 | C<T> |
| test.cpp:5:5:5:5 | (unnamed deduction guide) | test.cpp:4:8:4:8 | C<T> |
| test.cpp:6:5:6:5 | (unnamed deduction guide) | test.cpp:4:8:4:8 | C<T> |
| test.cpp:12:1:12:1 | C | test.cpp:4:8:4:8 | C<T> |

View File

@@ -3,6 +3,7 @@
template<typename T>
struct C {
C(const T);
C(char, char);
};
C(const double) -> C<int>;
@@ -10,6 +11,8 @@ C(const double) -> C<int>;
template<typename T>
C(const T) -> C<int>;
C(char, char) -> C<char>;
void test() {
new C<char>(0);
new C<int>(0);

View File

@@ -1,3 +0,0 @@
| file://:0:0:0:0 | C | test.cpp:4:8:4:8 | C<T> |
| test.cpp:5:5:5:5 | (unnamed deduction guide) | test.cpp:4:8:4:8 | C<T> |
| test.cpp:11:1:11:1 | C | test.cpp:4:8:4:8 | C<T> |