[Bug 268820] index C++ variable overloading
- In reply to: bugzilla-noreply_a_freebsd.org: "[Bug 268820] index C++ variable overloading"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 07 Jan 2023 23:26:34 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=268820
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
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.
--
You are receiving this mail because:
You are the assignee for the bug.