After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 147311 - sigc::bind causes unwanted pass-by-value behavior with MSVC++ 7.1
sigc::bind causes unwanted pass-by-value behavior with MSVC++ 7.1
Status: RESOLVED FIXED
Product: libsigc++
Classification: Bindings
Component: adaptors
2.0
Other Windows
: Normal normal
: ---
Assigned To: Martin Schulze
Martin Schulze
Depends on:
Blocks:
 
 
Reported: 2004-07-11 00:01 UTC by James Lin
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sigc::bind copy test (740 bytes, text/plain)
2004-07-11 00:02 UTC, James Lin
  Details
Patch to make libsigc++ more MSVC-friendly (12.03 KB, patch)
2004-08-02 21:14 UTC, James Lin
none Details | Review

Description James Lin 2004-07-11 00:01:09 UTC
Microsoft's VC++ 7.1 compiler (aka VC++2003, aka v. 13.10.3077 
by the compiler's versioning scheme) cannot compile libsigc++ 
2.0.3 without first disabling the LIBSIGC_TEMPLATE_PREFIX macro.

Unfortunately, the check that controls LIBSIGC_TEMPLATE_PREFIX 
also controls the use of sun_forte_workaround, so disabling one
enables the other.

With the MS VC++ 7.1 compiler, calling sun_forte_workaround
somehow causes arguments to be passed by value even when 
using reference types.

Decoupling sun_forte_workaround and LIBSIGC_TEMPLATE_PREFIX
to have separate, independent checks and using operator() 
instead of sun_forte_workaround seems to fix this issue with 
MSVC++.
Comment 1 James Lin 2004-07-11 00:02:36 UTC
Created attachment 29420 [details]
sigc::bind copy test

Test case attached.  The code passes an object with a private,
undefined copy-constructor to a signal declared to accept it
by reference.  If sun_forte_workaround is enabled, sigc::bind
attempts to copy the object and generates a compile-time error.
Comment 2 Danielle Madeley 2004-07-11 06:38:09 UTC
Adding the PATCH and 'portability' keywords.
Comment 3 Martin Schulze 2004-07-11 20:36:05 UTC
Modified configure check to decouple LIBSIGC_TEMPLATE_PREFIX and
sun_forte_workaround.
Discussion on ml yields that configure is not executed in the MSVC environment.
=> Awaiting patch for the MSVC project file that lets the compiler define
SIGC_CXX_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD.
Comment 4 Martin Schulze 2004-07-23 13:32:24 UTC
> => Awaiting patch for the MSVC project file that lets the compiler define
> SIGC_CXX_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD.

Hm, it seems that this was nonsense. In fact, sigc++config.h needs to be
configured according to the platform. Normally, this is done by the configure
script. What options do we have with MSVC?
Comment 5 James Lin 2004-07-26 00:08:21 UTC
I don't think adding those definitions to the project file is a good idea, since
some of the header files depend that sigc++config.h simply exists, and modifying
adaptor_trait.h to include sigc++config.h conditionally seems kind of ugly.

IMO it might be better to include a pre-generated copy of sigc++config.h
suitable for MSVC7.1 in the MSVC_Net2003 project directory.
Comment 6 James Lin 2004-08-02 21:14:07 UTC
Created attachment 30159 [details] [review]
Patch to make libsigc++ more MSVC-friendly

Summary of changes:
* Added SIGC_API qualifier to all externally-visible non-template 
  classes/structs.
* Added #include <sigc++config.h> to the files that use SIGC_API.
* Added empty SIGC_API definition to sigc++config.h.in for non-MSVC
  compilers.  I'm not sure if this is the right place to put this
  (probably not).
* Added MSVC-specific sigc++config.h to the MSVC project directory.
  (The comment in it probably should be edited.)
* Changed MSVC project settings to output a multi-threaded DLL, set 
  the include paths to work (hopefully) out-of-the-box.  Disabled
  precompiled headers, since they just complicate things and 
  shouldn't be necessary for such a relatively project.
Comment 7 Martin Schulze 2004-08-03 17:59:33 UTC
Committed to cvs. Thanks a lot! Please add the Changes summary to 'ChangeLog'
for future patches.

-> Closing in the assumption that the patch solves the configure problems for MSVC.