public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108391] New: Operator '::operator delete(void*, size_t)' was not found when clang compiled stdlibc++
@ 2023-01-13  9:43 jincikang at gmail dot com
  2023-01-13 12:54 ` [Bug libstdc++/108391] '::operator delete(void*, size_t)' was not found when clang compiled libstdc++ redi at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: jincikang at gmail dot com @ 2023-01-13  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108391
           Summary: Operator '::operator delete(void*, size_t)' was not
                    found when clang compiled stdlibc++
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jincikang at gmail dot com
  Target Milestone: ---

```C++
// main.cpp
#include <new>

int main() {
  void* p = ::operator new[](2);
  ::operator delete[](p, 2);
}
```

# no problem
$ g++ main.cpp -std=c++20
# no problem
$ clang++ main.cpp -std=c++20 -stdlib=libc++
$ clang++ main.cpp -std=c++20 
main.cpp:5:3: error: no matching function for call to 'operator delete[]'
  ::operator delete[](p, 2);
  ^~~~~~~~~~~~~~~~~~~
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:146:6:
note: candidate function not viable: no known conversion from 'int' to 'const
std::nothrow_t' for 2nd argument
void operator delete[](void*, const std::nothrow_t&) _GLIBCXX_USE_NOEXCEPT
     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:161:6:
note: candidate function not viable: no known conversion from 'int' to
'std::align_val_t' for 2nd argument
void operator delete[](void*, std::align_val_t)
     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:181:13:
note: candidate function not viable: no known conversion from 'int' to 'void *'
for 2nd argument
inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { }
            ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:132:6:
note: candidate function not viable: requires 1 argument, but 2 were provided
void operator delete[](void*) _GLIBCXX_USE_NOEXCEPT
     ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/12.2.0/../../../../include/c++/12.2.0/new:163:6:
note: candidate function not viable: requires 3 arguments, but 2 were provided
void operator delete[](void*, std::align_val_t, const std::nothrow_t&)
     ^
1 error generated


* The reason is that clang does not define the macro __cpp_sized_deallocation.
* I think `#ifndef _LIBCPP_HAS_NO_LIBRARY_SIZED_DEALLOCATION` in libc++ might
be a bit better

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-01-13 15:52 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-13  9:43 [Bug libstdc++/108391] New: Operator '::operator delete(void*, size_t)' was not found when clang compiled stdlibc++ jincikang at gmail dot com
2023-01-13 12:54 ` [Bug libstdc++/108391] '::operator delete(void*, size_t)' was not found when clang compiled libstdc++ redi at gcc dot gnu.org
2023-01-13 13:00 ` redi at gcc dot gnu.org
2023-01-13 13:08 ` jincikang at gmail dot com
2023-01-13 13:14 ` jakub at gcc dot gnu.org
2023-01-13 13:17 ` jincikang at gmail dot com
2023-01-13 13:25 ` redi at gcc dot gnu.org
2023-01-13 13:40 ` jakub at gcc dot gnu.org
2023-01-13 13:46 ` jincikang at gmail dot com
2023-01-13 13:50 ` jincikang at gmail dot com
2023-01-13 13:53 ` redi at gcc dot gnu.org
2023-01-13 13:54 ` jincikang at gmail dot com
2023-01-13 14:20 ` redi at gcc dot gnu.org
2023-01-13 15:52 ` jincikang at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).