[Bug c++/51777] New: Errors message show unsigned long template parameters as signed

luto at mit dot edu gcc-bugzilla@gcc.gnu.org
Fri Jan 6 20:37:00 GMT 2012


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

             Bug #: 51777
           Summary: Errors message show unsigned long template parameters
                    as signed
    Classification: Unclassified
           Product: gcc
           Version: 4.6.2
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: luto@mit.edu


On x86_64, with g++ (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1) and some trunk build
or other, this test:

template<unsigned long long>
struct A
{
};

int main()
{
  return A<0xf000000000000000ul>();
}

gives this error:

type_err_test.cc: In function ‘int main()’:
type_err_test.cc:8:34: error: cannot convert ‘A<-1152921504606846976ull>’ to
‘int’ in return

That's wrong -- the constant is positive.  (With just 'unsigned long' instead
of 'unsigned long long', it still gets it wrong on x86_64 but it gets it right
with -m32.  With 'unsigned long long' it fails both ways.)

I'm marking this "minor" because it's unlikely to cause significant confusion.



More information about the Gcc-bugs mailing list