Message ID | 20161021113653.GA26234@scylladb.com |
---|---|
State | New |
Headers | show |
On 21/10/16 14:36 +0300, Gleb Natapov wrote: >On Thu, Oct 20, 2016 at 11:53:49PM -0400, Ryan Burn wrote: >> Are exception classes required to support emplace new construction >> like that? With this change, Intel's TBB library no longer compiles >> because its exception class declares it's own new operator (see >> https://github.com/wjakob/tbb/blob/master/include/tbb/tbb_exception.h): >> >Can you test this patch please: That doesn't help, the overloaded new still prevents placement new. Dammit. I'll see what we can do ...
On 21/10/16 12:44 +0100, Jonathan Wakely wrote: >On 21/10/16 14:36 +0300, Gleb Natapov wrote: >>On Thu, Oct 20, 2016 at 11:53:49PM -0400, Ryan Burn wrote: >>>Are exception classes required to support emplace new construction >>>like that? With this change, Intel's TBB library no longer compiles >>>because its exception class declares it's own new operator (see >>>https://github.com/wjakob/tbb/blob/master/include/tbb/tbb_exception.h): >>> >>Can you test this patch please: > >That doesn't help, the overloaded new still prevents placement new. >Dammit. > >I'll see what we can do ... We should be able to us SFINAE to detect when the placement new-expression is valid.
On Fri, Oct 21, 2016 at 12:44:39PM +0100, Jonathan Wakely wrote: > On 21/10/16 14:36 +0300, Gleb Natapov wrote: > > On Thu, Oct 20, 2016 at 11:53:49PM -0400, Ryan Burn wrote: > > > Are exception classes required to support emplace new construction > > > like that? With this change, Intel's TBB library no longer compiles > > > because its exception class declares it's own new operator (see > > > https://github.com/wjakob/tbb/blob/master/include/tbb/tbb_exception.h): > > > > > Can you test this patch please: > > That doesn't help, the overloaded new still prevents placement new. > Dammit. > Hmm, are you sure. This program compiles for me (while fails without ::): #include<new> #include <stdlib.h> struct S { void* operator new (unsigned long size); }; main() { void* p = malloc(sizeof(S)); ::new(p) S(); } -- Gleb.
On Fri, Oct 21, 2016 at 02:58:26PM +0300, Gleb Natapov wrote: > On Fri, Oct 21, 2016 at 12:44:39PM +0100, Jonathan Wakely wrote: > > On 21/10/16 14:36 +0300, Gleb Natapov wrote: > > > On Thu, Oct 20, 2016 at 11:53:49PM -0400, Ryan Burn wrote: > > > > Are exception classes required to support emplace new construction > > > > like that? With this change, Intel's TBB library no longer compiles > > > > because its exception class declares it's own new operator (see > > > > https://github.com/wjakob/tbb/blob/master/include/tbb/tbb_exception.h): > > > > > > > Can you test this patch please: > > > > That doesn't help, the overloaded new still prevents placement new. > > Dammit. > > > Hmm, are you sure. This program compiles for me (while fails without ::): > Looks like tbb also compiles and pass tests. > #include<new> > #include <stdlib.h> > > struct S { > void* operator new (unsigned long size); > }; > > main() { > void* p = malloc(sizeof(S)); > ::new(p) S(); > } > > -- > Gleb. -- Gleb.
On 21/10/16 15:33 +0300, Gleb Natapov wrote: >On Fri, Oct 21, 2016 at 02:58:26PM +0300, Gleb Natapov wrote: >> On Fri, Oct 21, 2016 at 12:44:39PM +0100, Jonathan Wakely wrote: >> > On 21/10/16 14:36 +0300, Gleb Natapov wrote: >> > > On Thu, Oct 20, 2016 at 11:53:49PM -0400, Ryan Burn wrote: >> > > > Are exception classes required to support emplace new construction >> > > > like that? With this change, Intel's TBB library no longer compiles >> > > > because its exception class declares it's own new operator (see >> > > > https://github.com/wjakob/tbb/blob/master/include/tbb/tbb_exception.h): >> > > > >> > > Can you test this patch please: >> > >> > That doesn't help, the overloaded new still prevents placement new. >> > Dammit. >> > >> Hmm, are you sure. This program compiles for me (while fails without ::): >> >Looks like tbb also compiles and pass tests. Bah! I didn't include <new> in my test. I'll make that change, thanks. >> #include<new> >> #include <stdlib.h> >> >> struct S { >> void* operator new (unsigned long size); >> }; >> >> main() { >> void* p = malloc(sizeof(S)); >> ::new(p) S(); >> } >> >> -- >> Gleb. > >-- > Gleb.
diff --git a/libstdc++-v3/libsupc++/exception_ptr.h b/libstdc++-v3/libsupc++/exception_ptr.h index 21e4e8b..6ade626 100644 --- a/libstdc++-v3/libsupc++/exception_ptr.h +++ b/libstdc++-v3/libsupc++/exception_ptr.h @@ -190,7 +190,7 @@ namespace std (void)__cxxabiv1::__cxa_init_primary_exception(__e, const_cast<std::type_info*>(&typeid(__ex)), __exception_ptr::__dest_thunk<_Ex>); - new (__e) _Ex(__ex); + ::new (__e) _Ex(__ex); return exception_ptr(__e); #else throw __ex;