* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
@ 2009-05-18 22:34 ` paolo dot carlini at oracle dot com
2009-05-18 23:16 ` paolo at gcc dot gnu dot org
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-18 22:34 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from paolo dot carlini at oracle dot com 2009-05-18 22:34 -------
I'll fix it momentarily.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo dot carlini at oracle
|dot org |dot com
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2009-05-18 22:34:29
date| |
Summary|Unable to use std::vector |[4.4/4.5 Regression] Unable
|with typedef'd array types |to use std::vector with
| |typedef'd array types
Target Milestone|--- |4.4.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
2009-05-18 22:34 ` [Bug c++/40192] [4.4/4.5 Regression] " paolo dot carlini at oracle dot com
@ 2009-05-18 23:16 ` paolo at gcc dot gnu dot org
2009-05-18 23:17 ` paolo at gcc dot gnu dot org
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-05-18 23:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from paolo at gcc dot gnu dot org 2009-05-18 23:16 -------
Subject: Bug 40192
Author: paolo
Date: Mon May 18 23:16:20 2009
New Revision: 147680
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147680
Log:
2009-05-18 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/40192
* include/bits/stl_construct.h (struct _Destroy_aux): Add.
(_Destroy(_ForwardIterator, _ForwardIterator)): Use the latter.
* testsuite/23_containers/vector/40192.cc: New.
Added:
trunk/libstdc++-v3/testsuite/23_containers/vector/40192.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_construct.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
2009-05-18 22:34 ` [Bug c++/40192] [4.4/4.5 Regression] " paolo dot carlini at oracle dot com
2009-05-18 23:16 ` paolo at gcc dot gnu dot org
@ 2009-05-18 23:17 ` paolo at gcc dot gnu dot org
2009-05-18 23:18 ` paolo dot carlini at oracle dot com
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo at gcc dot gnu dot org @ 2009-05-18 23:17 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from paolo at gcc dot gnu dot org 2009-05-18 23:17 -------
Subject: Bug 40192
Author: paolo
Date: Mon May 18 23:16:48 2009
New Revision: 147681
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147681
Log:
2009-05-18 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/40192
* include/bits/stl_construct.h (struct _Destroy_aux): Add.
(_Destroy(_ForwardIterator, _ForwardIterator)): Use the latter.
* testsuite/23_containers/vector/40192.cc: New.
Added:
branches/gcc-4_4-branch/libstdc++-v3/testsuite/23_containers/vector/40192.cc
Modified:
branches/gcc-4_4-branch/libstdc++-v3/ChangeLog
branches/gcc-4_4-branch/libstdc++-v3/include/bits/stl_construct.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (2 preceding siblings ...)
2009-05-18 23:17 ` paolo at gcc dot gnu dot org
@ 2009-05-18 23:18 ` paolo dot carlini at oracle dot com
2009-05-19 16:36 ` jeff at schwabcenter dot com
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-18 23:18 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from paolo dot carlini at oracle dot com 2009-05-18 23:18 -------
Fixed for 4.4.1.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (3 preceding siblings ...)
2009-05-18 23:18 ` paolo dot carlini at oracle dot com
@ 2009-05-19 16:36 ` jeff at schwabcenter dot com
2009-05-19 16:42 ` paolo dot carlini at oracle dot com
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jeff at schwabcenter dot com @ 2009-05-19 16:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jeff at schwabcenter dot com 2009-05-19 16:36 -------
Whoa whoa whoa... The behavior seemed correct before. vector<float[4]>
shouldn't even be legal. Shouldn't the compiler to catch such a mistake?
--
jeff at schwabcenter dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jeff at schwabcenter dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (4 preceding siblings ...)
2009-05-19 16:36 ` jeff at schwabcenter dot com
@ 2009-05-19 16:42 ` paolo dot carlini at oracle dot com
2009-05-19 17:09 ` jeff at schwabcenter dot com
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-19 16:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2009-05-19 16:42 -------
I think that, in any case, we cannot do anything wrong here: we are simply
restoring an implementation detail of the previous implementations, which, as a
side effect, allows to compile this specific kind of snippet. Indeed, other
implementations also swallow it. So, let's take the legal issues aside, and
move on. If you figure specific details telling it's illegal just add it, as a
note, but certainly diagnostic is not required.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (5 preceding siblings ...)
2009-05-19 16:42 ` paolo dot carlini at oracle dot com
@ 2009-05-19 17:09 ` jeff at schwabcenter dot com
2009-05-19 17:12 ` paolo dot carlini at oracle dot com
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jeff at schwabcenter dot com @ 2009-05-19 17:09 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from jeff at schwabcenter dot com 2009-05-19 17:09 -------
I understand the desire for backward compatibility, but are the semantics
actually the same? Are the vector values arrays, or do they decay to pointers?
Section 23.1 says standard container elements have to be CopyConstructible and
assignable, but raw arrays are neither.
Is there at least some flag to re-enable the diagnostic? If you're saying this
is a necessary evil for reasons of backward compatibility, then I understand,
but in my opinion, this is a step backward that will confuse newcomers like
Brian and hurt cross-compatibility. Speaking strictly as a GCC user, I don't
see any reason to reduce the compiler's ability to deduce an obvious mistake
with ill-defined semantics.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (6 preceding siblings ...)
2009-05-19 17:09 ` jeff at schwabcenter dot com
@ 2009-05-19 17:12 ` paolo dot carlini at oracle dot com
2009-05-19 17:33 ` jeff at schwabcenter dot com
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-19 17:12 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo dot carlini at oracle dot com 2009-05-19 17:12 -------
This is not going to change again. We had this behaviour forever until 4.3.x
and all the major implementations outside GCC behave the same as GCC now (and
before the change of behavior).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (7 preceding siblings ...)
2009-05-19 17:12 ` paolo dot carlini at oracle dot com
@ 2009-05-19 17:33 ` jeff at schwabcenter dot com
2009-05-19 17:38 ` paolo dot carlini at oracle dot com
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: jeff at schwabcenter dot com @ 2009-05-19 17:33 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from jeff at schwabcenter dot com 2009-05-19 17:32 -------
OK. Thanks for the explanation. Are the semantics documented somewhere?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (8 preceding siblings ...)
2009-05-19 17:33 ` jeff at schwabcenter dot com
@ 2009-05-19 17:38 ` paolo dot carlini at oracle dot com
2009-05-19 17:58 ` coleb at eyesopen dot com
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-19 17:38 UTC (permalink / raw)
To: gcc-bugs
------- Comment #10 from paolo dot carlini at oracle dot com 2009-05-19 17:38 -------
Look closely at the patch I committed, I changed *nothing* of the actual
behavior of the containers. Thus the semantics is exactly the same as before,
only, the destructor in not called explicitly anymore on such element type,
because the destructor is trivial.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (9 preceding siblings ...)
2009-05-19 17:38 ` paolo dot carlini at oracle dot com
@ 2009-05-19 17:58 ` coleb at eyesopen dot com
2009-05-19 18:07 ` jeff at schwabcenter dot com
2009-05-19 18:19 ` paolo dot carlini at oracle dot com
12 siblings, 0 replies; 14+ messages in thread
From: coleb at eyesopen dot com @ 2009-05-19 17:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #11 from coleb at eyesopen dot com 2009-05-19 17:57 -------
(In reply to comment #10)
> Look closely at the patch I committed, I changed *nothing* of the actual
> behavior of the containers. Thus the semantics is exactly the same as before,
> only, the destructor in not called explicitly anymore on such element type,
> because the destructor is trivial.
>
Yup, even though you can declare a vector<float4>, you can't do anything useful
with it.
typedef float cl_float4[4] __attribute__((aligned(16)));
#include <vector>
int main()
{
std::vector<cl_float4> vals(1);
cl_float4 a = {1.0f, 2.0f, 3.0f, 4.0f};
vals.push_back(a);
}
/usr/local/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/stl_algobase.h:412:
error: ISO C++ forbids assignment of arrays
Does seem strange to allow vector<float4> to be compilable, but eh, lesson
learned, stay away from array types in C++.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (10 preceding siblings ...)
2009-05-19 17:58 ` coleb at eyesopen dot com
@ 2009-05-19 18:07 ` jeff at schwabcenter dot com
2009-05-19 18:19 ` paolo dot carlini at oracle dot com
12 siblings, 0 replies; 14+ messages in thread
From: jeff at schwabcenter dot com @ 2009-05-19 18:07 UTC (permalink / raw)
To: gcc-bugs
------- Comment #12 from jeff at schwabcenter dot com 2009-05-19 18:07 -------
What he said. I'm perusing your patch, and I appreciate that you removed an
artificial restriction. The right place to catch this is up front, in a
concept check, rather than in _Destroy; since I'm not about to add the check
myself, I'm hardly in a position to criticize. The diagnostic did have the
nice property of catching a real, semantic error, though, and it seems a shame
to let a known error go unreported.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread
* [Bug c++/40192] [4.4/4.5 Regression] Unable to use std::vector with typedef'd array types
2009-05-18 21:06 [Bug c++/40192] New: Unable to use std::vector with typedef'd array types coleb at eyesopen dot com
` (11 preceding siblings ...)
2009-05-19 18:07 ` jeff at schwabcenter dot com
@ 2009-05-19 18:19 ` paolo dot carlini at oracle dot com
12 siblings, 0 replies; 14+ messages in thread
From: paolo dot carlini at oracle dot com @ 2009-05-19 18:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #13 from paolo dot carlini at oracle dot com 2009-05-19 18:19 -------
It's life, you know ;)
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40192
^ permalink raw reply [flat|nested] 14+ messages in thread