Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22272

std::destroy_at differences between major compilers?

$
0
0

Using compiler explorer with:

#include <iostream>#include <memory>struct test{  test(int i)  {    std::cout << "test::test("<<i<<")\n";  }  ~test()  {    std::cout << "~test()\n";  }};template<>void std::destroy_at(test* p) {  std::cout<<"std::destroy_at<test>\n";  p->~test();}intmain (){  auto sp = std::make_shared<test>(3);  return 33;}

Gives the expected output using C++20 with gcc x86-64 or clang x86-64:

Program returned: 33test::test(3)std::destroy_at<test>~test()

But x64 msvc v19.32 gives:

Program returned: 33test::test(3)~test()

As if the std::destroy_at has no effect here.

Is this conforming behavior, my misunderstanding or a msvc non conformance or misconfiguration?


Viewing all articles
Browse latest Browse all 22272

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>