blob: 99150d2f0960edea83cf37f458ebb03276ff6b3c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// generic-type-arg-overloaded.slang
//DIAGNOSTIC_TEST:SIMPLE:
// Regression test to confirm that type checker
// doesn't crash when an overloaded identifier
// is used as a generic type argument.
interface IThing { int getVal(); }
struct Stuff : IThing { int getVal() { return 1; } }
// Conflicting declaration:
struct Stuff {}
int util<T : IThing>() { return 1; }
struct G {}
int nonGeneric() { return 2; }
int test()
{
// This call should note the ambiguity,
// rather than crash.
//
return util<Stuff>()
// Adding an extra call to also test the
// case of trying to speicalize something
// like a generic when it isn't one.
//
+ nonGeneric<G>();
}
|