[Bug libstdc++/35480] Relational operators for <tr1/tuple> don't error on different sized tuples
gryan at akoostix dot com
gcc-bugzilla@gcc.gnu.org
Thu Mar 6 16:38:00 GMT 2008
------- Comment #3 from gryan at akoostix dot com 2008-03-06 16:38 -------
I understand your concern here, which is why I wrote that I thought that it was
"implicit".
The standard says "where get<i>(t) == get<i>(u)" is a valid expression" only,
however; 6.1.3.4 says that get<i>(t) is "ill formed if I is out of bounds."
In the original proposal Jarvi writes "An attempt to compare two tuples of
different lengths results in a compile time error." This is co-operated by
Becker in his TR-1 book, where we writes "... can be compared if they have the
same number of elements..." But the standard itself isn't so explicit.
To me, if get<i>(t) fails to compile under the assumption of "ill formed", then
by the definitions of 6.1.3.5, get<i>(t) == get<i>(u) should also fail to
compile. Although it is not explicitly stated in N1836=05-0096.
At least that's my interpretation of "ill-formed." Are all ill-formed
expression compilation errors?
On an aside, it would certainly be useless to have something compile and run
with no side effects (as it does) when the construct is clearly erroneous.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35480
More information about the Gcc-bugs
mailing list