Skip to content

Commit a2c5e90

Browse files
authored
[SYCL][Doc] Clarify availability of get_property() (#5992)
The extension previously said that certain calls to get_property() must produce a compiler error, which could be satisfied by calling static_assert(). A static_assert()-based solution throws errors any time the get_property<> template is instantiated, which can lead to some surprising errors in user code. Stating that get_property() must only be available when the property type exists in the property list has two advantages: 1) Users can more easily reason about when errors will be thrown and how to avoid those errors. 2) Users can rely on all implementations to have the same error behavior. Signed-off-by: John Pennycook <[email protected]>
1 parent ae284f1 commit a2c5e90

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

sycl/doc/extensions/experimental/sycl_ext_oneapi_properties.asciidoc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,15 +444,16 @@ a|
444444
template<typename PropertyT>
445445
PropertyT get_property() const;
446446
``` | Returns a copy of the property value contained in the property list.
447-
Must produce a compile error if the property list does not contain a PropertyT property.
448-
Available only if `PropertyT` is a runtime property.
447+
Available only if `PropertyT` is a runtime property and the property list
448+
contains a `PropertyT` property.
449449
a|
450450
```c++
451451
template<typename PropertyKeyT>
452452
static constexpr auto get_property();
453453
``` | Returns a copy of the property value contained in the property list.
454-
Must produce a compile error if the property_list does not contain a property with the `PropertyKeyT` key.
455-
Available only if `PropertyKeyT` is the property key class of a compile-time constant property.
454+
Available only if `PropertyKeyT` is the property key class of a compile-time
455+
constant property and the property list contains a property with the
456+
`PropertyKeyT` key.
456457
|===
457458
--
458459

0 commit comments

Comments
 (0)