This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/57632] New: Operator new overloads with stdc++11 enabled looses exception specifier (MacOsX)
- From: "basv at odd-e dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 17 Jun 2013 05:51:08 +0000
- Subject: [Bug c++/57632] New: Operator new overloads with stdc++11 enabled looses exception specifier (MacOsX)
- Auto-submitted: auto-generated
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.