Boost C++ Libraries: Ticket #9474: boost/type_traits/has_new_operator.hpp causes compilation errors when macro "new" is defined https://svn.boost.org/trac10/ticket/9474 <p> It is a recommended practice to #define new DEBUG_NEW in order to detect memory leaks in MFC projects, but it causes compilation errors in boost/type_traits/has_new_operator.hpp due to undesirable macro substitution.<br /> I suggest to hide this macro at the beginning of the file and restore it at the end. Attached patch is suitable only for Visual C++ compiler.<br /> Best regards, Maksim. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/9474 Trac 1.4.3 anonymous Thu, 05 Dec 2013 15:31:41 GMT attachment set https://svn.boost.org/trac10/ticket/9474 https://svn.boost.org/trac10/ticket/9474 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">has_new_operator.hpp.patch</span> </li> </ul> Ticket Steven Watanabe Thu, 05 Dec 2013 20:59:30 GMT <link>https://svn.boost.org/trac10/ticket/9474#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9474#comment:1</guid> <description> <p> Recommended by who? You should never #define keywords. </p> </description> <category>Ticket</category> </item> <item> <author>myasnikovmaksim@…</author> <pubDate>Thu, 05 Dec 2013 22:15:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9474#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9474#comment:2</guid> <description> <p> Microsoft, I guess :-)<br /> I'm absolutely agree with about #defining keywords, but this happens. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Fri, 06 Dec 2013 21:30:52 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/9474#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9474#comment:3</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9474#comment:2" title="Comment 2">myasnikovmaksim@…</a>: </p> <blockquote class="citation"> <p> Microsoft, I guess :-)<br /> I'm absolutely agree with about #defining keywords, but this happens. </p> </blockquote> <p> Please don't do this. Repalce instead the global ::new/::delete operators. <a class="ext-link" href="http://stackoverflow.com/questions/8186018/how-to-properly-replace-global-new-delete-operators"><span class="icon">​</span>http://stackoverflow.com/questions/8186018/how-to-properly-replace-global-new-delete-operators</a> </p> </description> <category>Ticket</category> </item> <item> <dc:creator>John Maddock</dc:creator> <pubDate>Mon, 21 Apr 2014 08:40:44 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/9474#comment:4 https://svn.boost.org/trac10/ticket/9474#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Fixed in Git develop, but none the less as Viboes said: "don't do that"! </p> Ticket myasnikovmaksim@… Mon, 05 May 2014 17:13:56 GMT <link>https://svn.boost.org/trac10/ticket/9474#comment:5 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/9474#comment:5</guid> <description> <p> Replying to <a class="ticket" href="https://svn.boost.org/trac10/ticket/9474#comment:4" title="Comment 4">johnmaddock</a>: </p> <blockquote class="citation"> <p> Fixed in Git develop, but none the less as Viboes said: "don't do that"! </p> </blockquote> <p> Thank you. Needless to say that keyword redefinition is evil, but ancient code can be tricky.<br /> A minor adjustment if you please: there is no reason to keep macro BOOST_TT_AUX_MACRO_NEW_DEFINED defined after pop_macro("new") pragma. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 20 May 2014 06:35:50 GMT</pubDate> <title>attachment set https://svn.boost.org/trac10/ticket/9474 https://svn.boost.org/trac10/ticket/9474 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">has_new_operator.hpp</span> </li> </ul> Ticket myasnikovmaksim@… Fri, 10 Jul 2015 23:10:39 GMT attachment set https://svn.boost.org/trac10/ticket/9474 https://svn.boost.org/trac10/ticket/9474 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">has_new_operator.hpp.2.patch</span> </li> </ul> <p> #undef BOOST_TT_AUX_MACRO_NEW_DEFINED </p> Ticket