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

--- Comment #34 from Iain Sandoe <iains at gcc dot gnu.org> ---
(In reply to Jürgen Reuter from comment #33)
> (In reply to Iain Sandoe from comment #32)
> > (In reply to Jürgen Reuter from comment #31)
> > > Then I get tons of duplicate symbol lines.
> > 
> > ah well, not so simple then,

So .. I think things behave as expected .. like so:

$ cat op-new.C
#include <new>

extern int *foo ();

int main() {

  int *p2 = new (std::nothrow) int[10];
  int *px = foo ();

  delete[] p2;
  delete[] px;
}

$ cat foo.C
#include <new>

int *foo () {

   int *p2 = new (std::nothrow) int[10];

  if (p2)
     p2[3] = 10;
  return p2;
}

===

/opt/iains/PR88750/bin/g++ foo.C -shared -o libfoo.dylib

^^^ that makes a shared lib that references the libstdc++.dylib

/opt/iains/PR88750/bin/g++ op-new.C -L. -lfoo -o op-sh

^^ builds a "normal" C++ program that resolves the operator new [] from the
shared libstdc++.

/opt/iains/PR88750/bin/gcc -xc++ op-new.C
-Wl,-force_load,x86_64-apple-darwin16/libstdc++-v3/src/.libs/libstdc++.a -L.
-lfoo -o o-sta

(the path to the static instance is local there only because i patched the
operator new [] to print out which version was called.)

^^^ builds a program that uses the "o-sta" as the libstdc++ and resolves both
the call in main *and* the call in libfoo.dylib from the instance in o-sta.

=====

So, whatever else might be wrong - it is nothing to do with the warning that ld
emits.

Reply via email to