[Bug libstdc++/16875] Fails to compile: STL container of const pointer to X

loose at astron dot nl gcc-bugzilla@gcc.gnu.org
Thu Oct 7 07:32:00 GMT 2004


------- Additional Comments From loose at astron dot nl  2004-10-07 07:32 -------
(In reply to comment #12)

...
> Apparently icc uses a specialization of allocator to merge the declarations 
of 
> "address" when the argument type is const, which is a pretty trivial fix. No 
> existing code would be invalidated by the change.
...

After I posted this bug, with the notion that ICC did compile my code example 
with a container of const elements, I've been looking at the ICC STL header 
files, and (no offense to Intel, etc.) they seem to be based on STLport and 
look rather ancient. For instance, under the hood, this STL implementations 
uses void pointers throughout. This probably explains why my original example 
did compile using ICC. So, in short, the changes to be made to the GCC STL 
implementation will probably not be trivial, unless one would like to go back 
to the type unsafe void pointer era.

Furthermore, as was noted in comment #12, this is a more fundamental issue. The 
current C++ standard is pretty clear about the allocator rule (of which I was 
unaware at the time of submitting the bug report), however the reason behind 
this rule is very unclear and appears needlessly restrictive to me. Does anyone 
in the C++ standardization committee have something to say about this?

Marcel Loose.

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16875



More information about the Gcc-bugs mailing list