blob: d21ba073212c08186b76d4c70672cd90d664d380 (
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
34
|
// generic-type-arg-overloaded.slang
//DIAGNOSTIC_TEST:SIMPLE(filecheck=CHECK):
// 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:
//CHECK: ([[# @LINE+1]]): error 30200:
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>();
}
|