Topic: Defect in N2135/20.5.14.2.5: Return clause mentions undefined


Author: Pete Becker <pete@versatilecoding.com>
Date: Sat, 3 Feb 2007 12:07:27 CST
Raw View
Daniel Kr   gler wrote:
> Hello,
>
> 20.5.14.2.5 p. 4 of [func.wrap.func.targ] says:
>
> "Returns: If type() == typeid(T), a pointer to the stored function
> target; otherwise a null pointer."
>
> 1) There exists neither a type, a typedef "type", nor member function
> "type()" in class template function
> nor in the global or std namespace.
> 2) Assuming that "type" should have been "target_type()", this
> description would lead to false
> results, if T = cv void due to returns clause 20.5.14.2.5 p. 1.
>
> Proposed resolution:
>
> "Returns: If target_type() == typeid(T) && typeid(T) != typeid(void),
> a pointer to the stored function
> target; otherwise a null pointer."
>

Agreed. It's editorial, so I'll fix it.

--

 -- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and
Reference." (www.petebecker.com/tr1book)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: pete@versatilecoding.com (Pete Becker)
Date: Tue, 6 Feb 2007 21:41:02 GMT
Raw View
Daniel Kr=FCgler wrote:
> On 3 Feb., 19:07, Pete Becker <p...@versatilecoding.com> wrote:
>> Daniel Kr=FCgler wrote:
>>> Proposed resolution:
>>> "Returns: If target_type() =3D=3D typeid(T) && typeid(T) !=3D typeid(=
void),
>>> a pointer to the stored function
>>> target; otherwise a null pointer."
>> Agreed. It's editorial, so I'll fix it.
>=20
> Just after sending my contribution, I had to reconsider the 2nd
> part of my assertion, which leads to the proposed addition
> "&& typeid(T) !=3D typeid(void)". One could argue that its requires
> section, which says
>=20
> "T is a function object type that is Callable ([20.5.14.2]) for
> parameter
> types T1, T2, ..., TN and return type R."
>=20
> does exclude the need to take the void case into account. Formally
> this violation would lead to undefined behaviour according to
> 17.4.3.8, right? So the question arises, whether we want U.B. here, or
> not.
> Personally I see no need for that, so in this case the requires
> section
> could be removed here. What do you think?
>=20

I think that when I look at it I'll figure out how to say it. <g> I=20
don't have time now to do the analysis, but I've noted your comment.

--=20

 -- Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com)
Author of "The Standard C++ Library Extensions: a Tutorial and=20
Reference." (www.petebecker.com/tr1book)

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]