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

            Bug ID: 99006
           Summary: make_shared<T[]> silently works
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: Darrell.Wright at gmail dot com
  Target Milestone: ---

std::make_shared<T[]> in libstdc++ prior to c++20 doesn't fail.

The minimal example is

#include <memory>
int func( ) {
  auto sp = std::make_shared<int[]>( 55 );
  return *sp.get( );
}

will return 55;

libc++ removes it from the overload set and MS STL fails.
https://gcc.godbolt.org/z/PaW6WY

With T = int[], I think
https://timsong-https://timsong-cpp.github.io/cppwp/n4659/util.smartptr.shared.create#1
should make this not work.

Reply via email to