[Bug c++/81514] g++.dg/lookup/missing-std-include-2.C FAILs on Solaris

dmalcolm at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jul 27 17:08:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81514

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
I'm able to reproduce this on Linux by replacing:

  #include <stdio.h>

with:

  namespace std
  {
    extern int sprintf (char *dst, const char *format, ...);
  };

On Linux, the include of stdio.h seems to have been effectively doing this
(amongst many other things):

  extern int sprintf (char *dst, const char *format, ...);
  namespace std
  {
    using ::sprintf;
  };

and this gets rejected in consider_binding_level by this clause:

      /* Skip anticipated decls of builtin functions.  */
      if (TREE_CODE (d) == FUNCTION_DECL
          && DECL_BUILT_IN (d)
          && DECL_ANTICIPATED (d))
        {

Presumably Solaris' headers doing something like the other thing above.

Am working on a fix.


More information about the Gcc-bugs mailing list