Date: Sat, 07 Jan 2023 23:26:34 +0000 From: bugzilla-noreply@freebsd.org To: standards@FreeBSD.org Subject: [Bug 268820] index C++ variable overloading Message-ID: <bug-268820-99-1zeltwGn5c@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-268820-99@https.bugs.freebsd.org/bugzilla/> References: <bug-268820-99@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268820 Mark Millard <marklmi26-fbsd@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |marklmi26-fbsd@yahoo.com --- Comment #1 from Mark Millard <marklmi26-fbsd@yahoo.com> --- FYI: The specific error report is: # c++ string_index_use.cpp=20 string_index_use.cpp:3:13: error: redefinition of 'index' as different kind= of symbol std::string index; ^ /usr/include/strings.h:62:7: note: previous definition is here char *index(const char *, int) __pure; /* LEGACY */ ^ 1 error generated. for: # more string_index_use.cpp #include <string> std::string index; int main() { } I get the same for stable/13 and main [so: 14]. For reference, for the __BEGIN_DECLS related use in strings.h : # grep -r "define.*__BEGIN_DECLS" /usr/include/ /usr/include/sys/cdefs.h:#define __BEGIN_DECLS extern "C" { /usr/include/sys/cdefs.h:#define __BEGIN_DECLS and the code block is: #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else #define __BEGIN_DECLS #define __END_DECLS #endif The strings.h is used via /usr/include/string.h by the text: . . . #include <sys/cdefs.h> #include <sys/_null.h> #include <sys/_types.h> /* * Prototype functions which were historically defined in <string.h>, but * are required by POSIX to be prototyped in <strings.h>. */ #if __BSD_VISIBLE #include <strings.h> #endif . . . So __BSD_VISIBLE in involved in causing the extra definition of index. --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268820-99-1zeltwGn5c>