Thanks! Corrected the indentation, and applied in r182905. ~Aaron
On Wed, May 29, 2013 at 6:23 PM, Richard Smith <[email protected]> wrote: > On Wed, May 29, 2013 at 1:01 PM, Aaron Ballman <[email protected]> > wrote: >> >> On Wed, May 29, 2013 at 3:55 PM, Richard Smith <[email protected]> >> wrote: >> > On Wed, May 29, 2013 at 7:49 AM, Aaron Ballman <[email protected]> >> > wrote: >> >> >> >> #include <stdio.h> >> >> #include <stdlib.h> >> >> >> >> struct arbitrary_t {} arbitrary; >> >> >> >> void *operator new[]( size_t s, arbitrary_t ) throw() { return >> >> ::malloc( s >> >> ); } >> >> >> >> struct S { >> >> void *operator new( size_t s, arbitrary_t ) throw() { return >> >> ::malloc( s >> >> ); } >> >> }; >> >> >> >> int main() { >> >> S *s = new (arbitrary) S[2]; >> >> } >> >> >> >> This will yield a call to the global operator new[] instead of the >> >> class-specific operator new. Using new instead of new[] yields a call >> >> to the matching class-specific operator new still. So I think my test >> >> will have to move down below the check for a global operator new: >> >> >> >> <look for member operator new> >> >> <look for global operator new> >> >> +if (not found && looking for array new && MS mode) >> >> + <switch to looking for non-array new> >> >> + <look for global operator new> >> >> >> >> If you agree, then I'll make the changes and add another test to >> >> CodeGenCXX to ensure we're calling the proper one. >> > >> > >> > What happens if you remove the global array new? Is the class-specific >> > non-array new used then? >> >> You get an error: >> >> F:\Aaron Ballman\Desktop\test6.cpp(13) : error C2660: 'operator new' : >> function >> does not take 2 arguments > > > Weird... well, OK then. > > The indentation in SemaExprCXX.cpp in your latest patch looks a bit off > (maybe you ran diff with -b or -w?), otherwise LGTM. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
