Opened 10 years ago

Closed 5 years ago

#47191 closed defect (fixed)

clang-3.7: c++14: missing support for binary operator delete

Reported by: akimd (Akim Demaille) Owned by: macports-tickets@…
Priority: Normal Milestone:
Component: ports Version: 2.3.3
Keywords: C++14 Cc: jeremyhu (Jeremy Huddleston Sequoia), larryv (Lawrence Velázquez)
Port: clang-3.7

Description

Hi all,

C++14 changed the operator delete that the keyword delete should invoke from unary to binary. Currently, this operator appears to be missing. FWIW, it seems to work properly with G++, even though it appears to call the right operator delete. So I guess it means that libstdc++ is updated, but not libc++.

$ cat foo.cc
int main()
{
  auto f = new int;
  delete f;
}
$ clang++-mp-3.6 -std=c++14  foo.cc
$ clang++-mp-3.7 -std=c++14  foo.cc
Undefined symbols for architecture x86_64:
  "operator delete(void*, unsigned long)", referenced from:
      _main in foo-7bc325.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
$ g++-mp-5 -std=c++14  foo.cc
$ g++-mp-5 -std=c++14  foo.cc -c
$ nm foo.o| c++filt | less
0000000000000030 short EH_frame1
                 U operator delete(void*, unsigned long)
                 U operator new(unsigned long)
0000000000000000 T _main

Change History (3)

comment:1 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)

It's an issue in the STL, not the C++ runtime library. The runtime provides 'operator delete(void*)', and the STL provides 'operator delete(void*, unsigned long)'

Version 0, edited 10 years ago by jeremyhu (Jeremy Huddleston Sequoia) (next)

comment:2 Changed 10 years ago by jeremyhu (Jeremy Huddleston Sequoia)

comment:3 Changed 5 years ago by kencu (Ken)

Resolution: fixed
Status: newclosed

the upstream bug is marked as "resolved-fixed"

Note: See TracTickets for help on using tickets.