public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48582] New: Template non-type arguments doesn't accept null pointer constant value
@ 2011-04-12 20:33 boostcpp at gmail dot com
2011-08-25 20:21 ` [Bug c++/48582] " gintensubaru at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: boostcpp at gmail dot com @ 2011-04-12 20:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48582
Summary: Template non-type arguments doesn't accept null
pointer constant value
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: boostcpp@gmail.com
According to current C++0x draft 14.3.2 [temp.arg.nontype],
template non-type arguments can be a constant expression that evaluates to a
null pointer value or null member pointer value.
This change was made in n1905.
So the following code is well-formed.
template < void * = nullptr > void f() { }
int main()
{
f() ;
f<nullptr>() ;
f<0>() ;
constexpr void * ptr = nullptr ;
f<ptr>() ;
}
But current gcc does not accept it.
Or is this just unimplemented feature?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48582] Template non-type arguments doesn't accept null pointer constant value
2011-04-12 20:33 [Bug c++/48582] New: Template non-type arguments doesn't accept null pointer constant value boostcpp at gmail dot com
@ 2011-08-25 20:21 ` gintensubaru at gmail dot com
2011-08-27 3:04 ` [Bug c++/48582] [C++0x] [DR 342] " jason at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: gintensubaru at gmail dot com @ 2011-08-25 20:21 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48582
--- Comment #1 from Takaya Saito <gintensubaru at gmail dot com> 2011-08-25 20:09:49 UTC ---
Current C++0x draft 14.3.2/5 says 0 is not a valid template-argument
for a non-type template-parameter of pointer type.
So, `f<0>();' is ill-formed, as current gcc rejects it.
But 14.3.2/5 says both `(void*)0' and `nullptr' are valid,
so the other codes should be accepted.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48582] [C++0x] [DR 342] Template non-type arguments doesn't accept null pointer constant value
2011-04-12 20:33 [Bug c++/48582] New: Template non-type arguments doesn't accept null pointer constant value boostcpp at gmail dot com
2011-08-25 20:21 ` [Bug c++/48582] " gintensubaru at gmail dot com
@ 2011-08-27 3:04 ` jason at gcc dot gnu.org
2011-08-28 16:08 ` jason at gcc dot gnu.org
2011-08-28 20:16 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-27 3:04 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48582
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |rejects-valid
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011-08-27
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Summary|Template non-type arguments |[C++0x] [DR 342] Template
|doesn't accept null pointer |non-type arguments doesn't
|constant value |accept null pointer
| |constant value
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48582] [C++0x] [DR 342] Template non-type arguments doesn't accept null pointer constant value
2011-04-12 20:33 [Bug c++/48582] New: Template non-type arguments doesn't accept null pointer constant value boostcpp at gmail dot com
2011-08-25 20:21 ` [Bug c++/48582] " gintensubaru at gmail dot com
2011-08-27 3:04 ` [Bug c++/48582] [C++0x] [DR 342] " jason at gcc dot gnu.org
@ 2011-08-28 16:08 ` jason at gcc dot gnu.org
2011-08-28 20:16 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-28 16:08 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48582
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-28 15:38:33 UTC ---
Author: jason
Date: Sun Aug 28 15:38:29 2011
New Revision: 178144
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178144
Log:
Core DR 342
PR c++/48582
* pt.c (check_valid_ptrmem_cst_expr): A null member pointer value
is valid in C++11.
(convert_nontype_argument): Likewise. Implicitly convert nullptr
and do constant folding.
* mangle.c (write_template_arg_literal): Mangle null member
pointer values as 0.
* call.c (null_member_pointer_value_p): New.
* cp-tree.h: Declare it.
Added:
trunk/gcc/testsuite/g++.dg/abi/mangle50.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/call.c
trunk/gcc/cp/cp-tree.h
trunk/gcc/cp/mangle.c
trunk/gcc/cp/pt.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/48582] [C++0x] [DR 342] Template non-type arguments doesn't accept null pointer constant value
2011-04-12 20:33 [Bug c++/48582] New: Template non-type arguments doesn't accept null pointer constant value boostcpp at gmail dot com
` (2 preceding siblings ...)
2011-08-28 16:08 ` jason at gcc dot gnu.org
@ 2011-08-28 20:16 ` jason at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-28 20:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48582
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.7.0
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-28 15:39:14 UTC ---
Implemented for 4.7.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-28 15:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-12 20:33 [Bug c++/48582] New: Template non-type arguments doesn't accept null pointer constant value boostcpp at gmail dot com
2011-08-25 20:21 ` [Bug c++/48582] " gintensubaru at gmail dot com
2011-08-27 3:04 ` [Bug c++/48582] [C++0x] [DR 342] " jason at gcc dot gnu.org
2011-08-28 16:08 ` jason at gcc dot gnu.org
2011-08-28 20:16 ` jason at gcc dot gnu.org
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).