www.digitalmars.com         C & C++   DMDScript  

c++ - Problem with new (nothrow)

reply "Alex Vinokur" <alexvn connect.to> writes:
Digital Mars C++ doesn't compile a program below.

------ foo.cpp ------
#include <new>
using namespace std;

main()
{
char* p = new (nothrow) char [100];
  delete[] p;
  return 0;
}
------------------

dmc 8.42.n (Dowloaded as Version 8.47)

-------------------------------------------------
$ dmc -I. -IC:/dm/stlport/stlport foo.cpp
char* p = new (nothrow) char [100];
                                  ^
foo2.cpp(6) : Error: no match for function '?_P(unsigned ,const std::nothrow_t)'

--- errorlevel 1
-------------------------------------------------


-- 
 Alex Vinokur
     email: alex DOT vinokur AT gmail DOT com
     http://mathforum.org/library/view/10978.html
     http://sourceforge.net/users/alexvn
Apr 15 2006
next sibling parent "Alex Vinokur" <alexvn connect.to> writes:
"Alex Vinokur" <alexvn connect.to> wrote in message
news:e1qnjm$1vec$1 digitaldaemon.com...
[snip]
 -------------------------------------------------
 $ dmc -I. -IC:/dm/stlport/stlport foo.cpp
 char* p = new (nothrow) char [100];
........................................................................... ................... ^
 foo2.cpp(6) : Error: no match for function '?_P(unsigned ,const
std::nothrow_t)'
Of course: foo.cpp(6) : Error: no match for function '?_P(unsigned ,const std::nothrow_t)' ...............................................................................................
 --- errorlevel 1
 -------------------------------------------------
-- Alex Vinokur email: alex DOT vinokur AT gmail DOT com http://mathforum.org/library/view/10978.html http://sourceforge.net/users/alexvn
Apr 15 2006
prev sibling parent %u <frwxg0hia3t65e5 temporaryinbox.com> writes:
mingw 3.4.2 compiler does
Oct 12 2008