jeudi 28 juin 2018

Private delete operator complie-time error with gcc but not clang

this is a follow up to this question

when using nothrow allocators the code compile with clang but not with gcc

#include <new>

class X {
   public:
      X() noexcept { }    
   private:
      static void operator delete(void*) { }
};

int main() { 
    X* x = new(std::nothrow) X{}; 
}

demo

which compiler is right ?

Aucun commentaire:

Enregistrer un commentaire