[Bug c++/13101] New: incorrect warning on initialized extern const function pointer

jbeulich at novell dot com gcc-bugzilla@gcc.gnu.org
Tue Nov 18 10:45:00 GMT 2003


While for most other types the warning does, as expected, not occur, the
following construct causes it. Since the warning cannot be suppressed this
especially causes problems in -Werror contexts. Note additionally that despite
the warning that object is placed into .rodata (which indicates that the
compiler did not lose the 'const' qualifier, as could be assumed by inspecting
the check made in grokdeclarator(), which obviously suggests the qualifier is
missing). Not also that omitting the extern specifier and turning on
optimization leads to the symbol being eliminated if otherwise unreferenced (as
expected, but considered another proof of the const qualifier being honored in
every other respect).

extern void(*const ptr)() = 0;

-- 
           Summary: incorrect warning on initialized extern const function
                    pointer
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jbeulich at novell dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-gnu-linux
  GCC host triplet: i686-pc-gnu-linux
GCC target triplet: i686-pc-gnu-linux


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



More information about the Gcc-bugs mailing list