public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/43813]  New: vector<T*>(3, NULL) fails to compile
@ 2010-04-20  7:07 jyasskin at gmail dot com
  2010-04-20  9:40 ` [Bug libstdc++/43813] [DR1234] " redi at gcc dot gnu dot org
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: jyasskin at gmail dot com @ 2010-04-20  7:07 UTC (permalink / raw)
  To: gcc-bugs

-------
#include <vector>
std::vector<double*> v(7, 0);
-------

lands on the

template <class InputIterator> vector(InputIterator first, InputIterator last,
const Allocator& = Allocator()); 

constructor instead of

explicit vector(size_type n, const T& value = T(), const Allocator& =
Allocator()); 

which the user intended. The InputIterator constructor tries to forward to
_M_fill_initialize because both arguments are integral, but the "0" has now
been permanently bound to the int type, stopping it from converting to a null
double*.

http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#1234 indicates that
the current behavior is conformant, but that the committee seems to want to
require the call to do what the user intended in a future standard.

Passing "NULL" instead of "0" makes the error depend on the build target. For
example, NULL appears to be an int on x86-32 but a long on x86-64, meaning the
error appears on x86-32 but not on x86-64.


-- 
           Summary: vector<T*>(3, NULL) fails to compile
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jyasskin at gmail dot com


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


^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2012-03-07 18:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-43813-4@http.gcc.gnu.org/bugzilla/>
2011-10-28 10:00 ` [Bug libstdc++/43813] [DR1234] vector<T*>(3, NULL) fails to compile marc.glisse at normalesup dot org
2012-02-23  1:02 ` jyasskin at gcc dot gnu.org
2012-02-23 11:37 ` paolo.carlini at oracle dot com
2012-02-23 12:47 ` paolo.carlini at oracle dot com
2012-03-04 11:32 ` paolo.carlini at oracle dot com
2012-03-04 11:39 ` paolo.carlini at oracle dot com
2012-03-04 12:02 ` redi at gcc dot gnu.org
2012-03-04 12:59 ` paolo.carlini at oracle dot com
2012-03-04 13:07 ` redi at gcc dot gnu.org
2012-03-05  1:16 ` paolo at gcc dot gnu.org
2012-03-05  1:18 ` paolo.carlini at oracle dot com
2012-03-07 18:44 ` redi at gcc dot gnu.org
2010-04-20  7:07 [Bug libstdc++/43813] New: " jyasskin at gmail dot com
2010-04-20  9:40 ` [Bug libstdc++/43813] [DR1234] " redi at gcc dot gnu dot org
2010-04-20  9:41 ` redi at gcc dot gnu dot org
2010-04-20 16:11 ` paolo dot carlini at oracle dot com
2010-04-20 16:36 ` jyasskin at gmail dot com
2010-04-20 16:50 ` redi at gcc dot gnu dot org
2010-04-20 17:00 ` redi at gcc dot gnu dot org
2010-04-20 20:04 ` jyasskin at gmail dot com
2010-04-21  0:33 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).