Date: Mon, 27 Apr 2026 21:51:51 +0200
Hi,
n3876.pdf has the following example:
template <typename Ty>
void func(Ty *ptr, Ty val);
_Optional int *ptr = foo();
func(ptr, 12);
as an example why the qualifier is at the "wrong" position
and this would cause problems for C++. It states
"When the qualifier is correctly associated with the pointer
rather than the pointee, the semantics work as a C++ programmer
would expect and Ty would deduce unambiguously to int"
But if you replace "_Optional" with "const" the example also fails
deduce unambigously. So is "const" also in the wrong location?
Can somebody explain me what the authors mean?
Martin
n3876.pdf has the following example:
template <typename Ty>
void func(Ty *ptr, Ty val);
_Optional int *ptr = foo();
func(ptr, 12);
as an example why the qualifier is at the "wrong" position
and this would cause problems for C++. It states
"When the qualifier is correctly associated with the pointer
rather than the pointee, the semantics work as a C++ programmer
would expect and Ty would deduce unambiguously to int"
But if you replace "_Optional" with "const" the example also fails
deduce unambigously. So is "const" also in the wrong location?
Can somebody explain me what the authors mean?
Martin
Received on 2026-04-27 19:51:55
