[cfe-commits] r86755 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDeclCXX.cpp test/CodeGenCXX/new-operator-phi.cpp test/SemaCXX/new-delete.cpp

Sebastian Redl sebastian.redl at getdesigned.at
Wed Nov 11 13:45:07 PST 2009


Fariborz Jahanian wrote:
> Author: fjahanian
> Date: Tue Nov 10 17:47:18 2009
> New Revision: 86755
>
> URL: http://llvm.org/viewvc/llvm-project?rev=86755&view=rev
> Log:
> Diagnose illegally typed operator new/new[].
>
> +class Base {
> +public:
> +  static int operator new(unsigned size) throw(); // expected-error {{'operator new' takes type size_t}} \
> +						  // expected-error {{operator new' must return type 'void *'}}
> +  static int operator new[] (unsigned size) throw(); // expected-error {{'operator new[]' takes type size_t}} \
> +						     // expected-error {{operator new[]' must return type 'void *'}}
> +};
>   
Hi,

This looks unnecessarily brittle. I'm sure there's some platform out 
there that defines size_t to unsigned int. (Win32?) Why not make it a 
signed type or something really small?

Sebastian



More information about the cfe-commits mailing list