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: unassig...@gcc.gnu.org
        ReportedBy: boost...@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*'
}

Reply via email to