public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/48871] New: gcc doesn't accept null pointer value as a template non-type argument
@ 2011-05-04 14:26 boostcpp at gmail dot com
  2011-05-04 14:39 ` [Bug c++/48871] " redi at gcc dot gnu.org
  2011-05-05 10:36 ` rguenth at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: boostcpp at gmail dot com @ 2011-05-04 14:26 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: gcc doesn't accept null pointer value as a template
                    non-type argument
           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 14.3.2 [temp.arg.nontype],
a constant expression that evaluates to a null pointer or null member pointer
value can be a template argument.

Thus, following code is well-formed.
But gcc issues errors.

template < void * ptr >
struct X { } ;

int main()
{
    X< 0 > x1 ; // error: could not convert template argument '0' to 'void*'
    X< nullptr > x2 ; // error: could not convert template argument 'nullptr'
to 'void*'
}


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

* [Bug c++/48871] gcc doesn't accept null pointer value as a template non-type argument
  2011-05-04 14:26 [Bug c++/48871] New: gcc doesn't accept null pointer value as a template non-type argument boostcpp at gmail dot com
@ 2011-05-04 14:39 ` redi at gcc dot gnu.org
  2011-05-05 10:36 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: redi at gcc dot gnu.org @ 2011-05-04 14:39 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-05-04 14:37:05 UTC ---
I think this is a dup of PR 10541


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

* [Bug c++/48871] gcc doesn't accept null pointer value as a template non-type argument
  2011-05-04 14:26 [Bug c++/48871] New: gcc doesn't accept null pointer value as a template non-type argument boostcpp at gmail dot com
  2011-05-04 14:39 ` [Bug c++/48871] " redi at gcc dot gnu.org
@ 2011-05-05 10:36 ` rguenth at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu.org @ 2011-05-05 10:36 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Guenther <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE

--- Comment #2 from Richard Guenther <rguenth at gcc dot gnu.org> 2011-05-05 10:29:50 UTC ---
.

*** This bug has been marked as a duplicate of bug 10541 ***


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

end of thread, other threads:[~2011-05-05 10:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-04 14:26 [Bug c++/48871] New: gcc doesn't accept null pointer value as a template non-type argument boostcpp at gmail dot com
2011-05-04 14:39 ` [Bug c++/48871] " redi at gcc dot gnu.org
2011-05-05 10:36 ` rguenth 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).