This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57632] New: Operator new overloads with stdc++11 enabled looses exception specifier (MacOsX)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57632

            Bug ID: 57632
           Summary: Operator new overloads with stdc++11 enabled looses
                    exception specifier (MacOsX)
           Product: gcc
           Version: 4.8.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: basv@odd-e.com

G++ on MacOsX acts different when enabling the new c++11 related to operator
new overloads. If I compile the following code:

#include "stdlib.h"
#include <new>

void* operator new(size_t mem) throw(std::bad_alloc);
void* operator new(size_t mem) throw(std::bad_alloc);

Then when compiling g++ new.cpp, it compiles fine.
But when I compile g++ -std=c++11 new.cpp, then it results in this error:

new.cpp:6:52: error: declaration of âvoid* operator new(size_t) throw
(std::bad_alloc)â has a different exception specifier
 void* operator new(size_t mem) throw(std::bad_alloc);
                                                    ^
new.cpp:5:7: error: from previous declaration âvoid* operator new(std::size_t)â
 void* operator new(size_t mem) throw(std::bad_alloc);
       ^
------------

I've not been able to replicate this under linux and digging into it a bit, it
seems to relate to the c++config.h definitions of _GLIBCXX_THROW.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]