Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4344 closed Patches (fixed)

[helper1.cpp] Please consider a qualified call to boost::enable_error_info

Reported by: niels_dekker Owned by: Emil Dotchevski
Milestone: Boost 1.43.0 Component: exception
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc:

Description

exception/test/helper1.cpp has an unqualified call to enable_error_info:

throw enable_error_info( std::length_error("exception test length error") );

Because the namespace is unspecified, the compiler has to look into the global namespace, boost, boost::exception_test, and the namespace(s) associated with its argument (ADL), in order to find the best match for the enable_error_info function call.

Is the function enable_error_info really meant to be customizable that way, by allowing to add an overload of enable_error_info to one of the namespaces associated with its argument? Otherwise I think it's preferable to do a qualified call to boost::enable_error_info:

throw boost::enable_error_info( std::length_error("exception test length error") );

This little modification would also make it easier to get enable_error_info_test compiling on Codegear. Your unqualified function call triggers an internal compiler error, as I just reported to Embarcadero: http://qc.embarcadero.com/wc/qcmain.aspx?d=85444

Attachments (1)

helper1_cpp_qualified_call_to_boost_enable_error_info.patch (513 bytes ) - added by niels_dekker 12 years ago.
helper1.cpp qualified call to boost::enable_error_info

Download all attachments as: .zip

Change History (4)

by niels_dekker, 12 years ago

helper1.cpp qualified call to boost::enable_error_info

comment:1 by niels_dekker, 12 years ago

Type: BugsPatches

Hi Emil,

Is it okay to you if I commit the attached patch to the trunk? https://svn.boost.org/trac/boost/attachment/ticket/4344/helper1_cpp_qualified_call_to_boost_enable_error_info.patch

-- Niels

comment:2 by Emil Dotchevski, 12 years ago

Resolution: fixed
Status: newclosed

Done, release branch revision #67128

in reply to:  2 comment:3 by niels_dekker, 12 years ago

Replying to emildotchevski:

Done, release branch revision #67128

Hi Emil,

Thanks for [67128] but my patch is about the trunk version of helper1.cpp Why don't you apply the patch to that specific file? The unqualified enable_error_info call is still there at https://svn.boost.org/svn/boost/trunk/libs/exception/test/helper1.cpp

Note: See TracTickets for help on using tickets.