summaryrefslogtreecommitdiffstats
path: root/tests/bugs/c-style-cast-coerce.slang
blob: e01903e2cc62f02b016afba839101ef90ed8e4ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//TEST:SIMPLE:

// It used to be the case that coercions of already-coerced initializer lists
// didn't take into account the more specific type. One way of triggering this
// was to create an already-coerced initializer list via the HLSL `(S)0`
// syntax which creates the equivalent of `{} : S`. In the example below this
// then proceeds to be coerced to type T.

struct S {};
struct T {};

void main()
{
    // Should generate a type error.
    T t = (S)0;
}