Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions proposals/0043-groupshared-arguments.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,51 @@ void caller() {
}
```

### Templates

```c++
template<typename T>
void fnT(T A, T B) {
A = B;
}
```

In Clang, given the above template, the following explicit instantiation should produce
a template instantiation with groupshared uint for both parameters.
In DXC, `groupshared` is not currently treated as a type qualifier in all situations
making the below example ignore the `groupshared` annotation on `uint`. DXC produces
this warning:
"warning: 'groupshared' attribute ignored when parsing type [-Wignored-attributes]".

```c++
groupshared uint Shared;
void caller() {
fnT<groupshared uint>(Shared, Shared);
}
```

In Clang and DXC, given the above template, the following instantiation which requires deduction
should produce a template instantiation that ignores that `Shared` is groupshared
because type qualifiers are ignored when performing type deduction for template
instantiation.

```c++
groupshared uint Shared;
void caller() {
fnT(Shared, Shared);
}
```

The below example is supported by both Clang and DXC and every instantiation of this template
has a groupshared argument.

```c++
template<typename T>
T fnT(groupshared T A) {
return A;
}
```

### Errors and Warnings

The `groupshared` type annotation keyword will be allowed on function parameter
Expand Down