[Bug c/54823] New: string literal characters not constant

devel at fresse dot org gcc-bugzilla@gcc.gnu.org
Fri Oct 5 11:13:00 GMT 2012


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

             Bug #: 54823
           Summary: string literal characters not constant
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: devel@fresse.org


this:

int main(void)
{
  int c = *" ";
  printf("%x\n", c);
  return 0;
}

results in (the constant expression):

     movl    $32, %eax

But this:

int main(void)
{
  enum {foo = *" "};
  printf("%x\n", foo);
  return 0;
}

gives
error: enumerator value for 'foo' is not an integer constant.

Whereas icc for instance just accepts the second form as constant integer
expression.



More information about the Gcc-bugs mailing list