This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/35480] Relational operators for <tr1/tuple> don't error on different sized tuples
- From: "gryan at akoostix dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Mar 2008 16:38:14 -0000
- Subject: [Bug libstdc++/35480] Relational operators for <tr1/tuple> don't error on different sized tuples
- References: <bug-35480-15866@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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