public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/34480] New: Argument packs treat __null oddly
@ 2007-12-15 14:18 gcc at magfr dot user dot lysator dot liu dot se
2007-12-15 20:10 ` [Bug c++/34480] " pinskia at gcc dot gnu dot org
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: gcc at magfr dot user dot lysator dot liu dot se @ 2007-12-15 14:18 UTC (permalink / raw)
To: gcc-bugs
The following program fails to compile in c++0x mode:
template <class ... A> void* f(A... a) { return new (char*)(a...); }
int main() {
f(__null);
}
Now, this doesn't sound that bad until one notice that this is functionally
equivalent with
#include <vector>
int main() {
std::vector<char*> v;
v.push_back(NULL);
}
and that used to and still do work perfectly well under c++98.
Note that if __null is replaced with 0 then it works so this suggests that the
__null case have been forgotten somewhere.
--
Summary: Argument packs treat __null oddly
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gcc at magfr dot user dot lysator dot liu dot se
GCC build triplet: i586-pc-linux-gnu
GCC host triplet: i586-pc-linux-gnu
GCC target triplet: i586-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
@ 2007-12-15 20:10 ` pinskia at gcc dot gnu dot org
2008-01-02 22:58 ` sylvain dot pion at sophia dot inria dot fr
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-12-15 20:10 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-12-15 20:10 -------
Well what type does NULL would have when passed?
And passing 0 also fails.
This might be a defect in the C++0x part of the standard.
Also I think we really do have an ODR violation in libstdc++ if the methods
change with -std=c++0x (which I think the C++0x standard really should
mention).
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
2007-12-15 20:10 ` [Bug c++/34480] " pinskia at gcc dot gnu dot org
@ 2008-01-02 22:58 ` sylvain dot pion at sophia dot inria dot fr
2008-01-02 23:00 ` pcarlini at suse dot de
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: sylvain dot pion at sophia dot inria dot fr @ 2008-01-02 22:58 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from sylvain dot pion at sophia dot inria dot fr 2008-01-02 21:37 -------
In fact, this is not really an issue with variadic templates,
since you get the same problem with:
void* g(int a) { return new (char*)(a); }
int main() {
g(__null);
}
Nevertheless, I opened an issue for the LWG for the original problem
with std::vector::push_back() which bothers me as well. The preview
of it can be found here:
http://home.twcny.rr.com/hinnant/cpp_extensions/issues_preview/lwg-active.html#767
I suggest that the component for this bug be changed from c++ to libstdc++,
and the title to something like:
"[LWG Issue 767] push_back and push_front need overloads for type T"
--
sylvain dot pion at sophia dot inria dot fr changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sylvain dot pion at sophia
| |dot inria dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
2007-12-15 20:10 ` [Bug c++/34480] " pinskia at gcc dot gnu dot org
2008-01-02 22:58 ` sylvain dot pion at sophia dot inria dot fr
@ 2008-01-02 23:00 ` pcarlini at suse dot de
2008-01-18 16:49 ` dgregor at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pcarlini at suse dot de @ 2008-01-02 23:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pcarlini at suse dot de 2008-01-02 21:53 -------
(In reply to comment #1)
> I suggest that the component for this bug be changed from c++ to libstdc++,
> and the title to something like:
>
> "[LWG Issue 767] push_back and push_front need overloads for type T"
Please don't. I mean, the PR would be immediately suspended, of course. We
don't want to have PRs for each (thousands) step toward C++0x...
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
` (2 preceding siblings ...)
2008-01-02 23:00 ` pcarlini at suse dot de
@ 2008-01-18 16:49 ` dgregor at gcc dot gnu dot org
2008-01-18 16:54 ` [Bug libstdc++/34480] " dgregor at gcc dot gnu dot org
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-18 16:49 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from dgregor at gcc dot gnu dot org 2008-01-18 16:32 -------
Confirmed. This is the right behavior according to the C++0x specification, but
the backward-compatibility issue with push_back is a problem. The C++ committee
is aware is the issue.
--
dgregor at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2008-01-18 16:32:16
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
` (3 preceding siblings ...)
2008-01-18 16:49 ` dgregor at gcc dot gnu dot org
@ 2008-01-18 16:54 ` dgregor at gcc dot gnu dot org
2008-10-02 13:53 ` paolo dot carlini at oracle dot com
2008-10-18 23:06 ` paolo dot carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: dgregor at gcc dot gnu dot org @ 2008-01-18 16:54 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from dgregor at gcc dot gnu dot org 2008-01-18 16:33 -------
Suspended for now. We'll pick up the library work again once the C++ committee
has resolved this issue.
--
dgregor at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |SUSPENDED
Component|c++ |libstdc++
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
` (4 preceding siblings ...)
2008-01-18 16:54 ` [Bug libstdc++/34480] " dgregor at gcc dot gnu dot org
@ 2008-10-02 13:53 ` paolo dot carlini at oracle dot com
2008-10-18 23:06 ` paolo dot carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-10-02 13:53 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from paolo dot carlini at oracle dot com 2008-10-02 13:52 -------
The issue with vector::push_back is fixed in mainline. The issue with std::pair
(per DR 767) is still there, however. Maybe Doug can add something about the
latter...
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |paolo at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug libstdc++/34480] Argument packs treat __null oddly
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
` (5 preceding siblings ...)
2008-10-02 13:53 ` paolo dot carlini at oracle dot com
@ 2008-10-18 23:06 ` paolo dot carlini at oracle dot com
6 siblings, 0 replies; 8+ messages in thread
From: paolo dot carlini at oracle dot com @ 2008-10-18 23:06 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2008-10-18 23:05 -------
The issue with std::pair is now also fixed by:
2008-10-18 Douglas Gregor <doug.gregor@gmail.com>
* include/bits/stl_pair.h (__may_be_null_pointer_init): New.
(pair::pair): Eliminate the redundant pair(U1&&, U2&&) constructor.
Add lvalue pair<U1, U2> constructor to handle non-const pair lvalues.
Remove the old variadic constructor, and instead provide several
variadic constructors that avoid failing when attempting to
initialize a pointer from a null pointer constant.
* testsuite/20_util/pair/moveable.cc (test3): Add new tests with
initialization of pointers from the null pointer constant.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|SUSPENDED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.4.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34480
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-10-18 23:06 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-15 14:18 [Bug c++/34480] New: Argument packs treat __null oddly gcc at magfr dot user dot lysator dot liu dot se
2007-12-15 20:10 ` [Bug c++/34480] " pinskia at gcc dot gnu dot org
2008-01-02 22:58 ` sylvain dot pion at sophia dot inria dot fr
2008-01-02 23:00 ` pcarlini at suse dot de
2008-01-18 16:49 ` dgregor at gcc dot gnu dot org
2008-01-18 16:54 ` [Bug libstdc++/34480] " dgregor at gcc dot gnu dot org
2008-10-02 13:53 ` paolo dot carlini at oracle dot com
2008-10-18 23:06 ` 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).