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

            Bug ID: 83662
           Summary: std::aligned_alloc() not available
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nico at josuttis dot de
  Target Milestone: ---

C++17 is based on C11, which now standardizes aligned_alloc().
However, <cstdlib> does not provide it under namespace std:

#include <cstdlib>

int main()
{
  auto p1 = std::malloc(100);             // OK
  auto p2 = aligned_alloc(64, 100);       // OK
  auto p3 = std::aligned_alloc(64, 100);  // ERROR
}

Error:
 prog.cc: In function 'int main()':
 prog.cc:7:18: error: 'aligned_alloc' is not a member of 'std'
   auto p3 = std::aligned_alloc(64, 100);  // ERROR
                  ^~~~~~~~~~~~~
 prog.cc:7:18: note: suggested alternative: 'align_val_t'
   auto p3 = std::aligned_alloc(64, 100);  // ERROR
                  ^~~~~~~~~~~~~
                  align_val_t

Reply via email to