[Bug c/17328] New: strlen() of static const char* string not allowed by gcc at compile time

smsti at ashtray dot jz dot gts dot cz gcc-bugzilla@gcc.gnu.org
Sun Sep 5 13:55:00 GMT 2004


fn()
{
  static const char *p = "ahoj";
  static int i = strlen("ahoj"); // will pass
  static int j = strlen(p);      // will not pass: error: initializer element is 
not constant
}

-- 
           Summary: strlen() of static const char* string not allowed by gcc
                    at compile time
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: smsti at ashtray dot jz dot gts dot cz
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i486-slackware-linux
GCC target triplet: i486-slackware-linux


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



More information about the Gcc-bugs mailing list