This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]