Opened 12 years ago

#4526 new Bugs

[MSVC 10 & 9 & 8] forward declarations of concept checked function templates don't work (compiler bug?)

Reported by: Stefan van Kessel <van_kessel@…> Owned by: jsiek
Milestone: Boost 1.44.0 Component: concept_check
Version: Boost 1.43.0 Severity: Problem
Keywords: concept_check forward-declaration Cc:

Description

As posted by Lorenzo Caminiti to comp.lib.boost.devel (8/9/2010) forward declarations of concept checked function templates lead to ambiguity errors even though the function signatures are identical when compiled with MSVC (I tested MSVC 10 & MSVC9, Caminit MSVC8)

I believe it boils down to a compiler error where MSVC fails to recognize that signatures are identical when the return type depends on fairly complex expressions that include non type template arguments. I've got a patch that seems to work for MSVC10. Since I used decltype it doesn't help for the older versions though. I haven't tested it much and I'm sure I'm breaking all kinds of boost coding guidelines but maybe it's of help anyway.

Attachments (4)

patchfile.patch (1.3 KB ) - added by Stefan van Kessel <van_kessel@…> 12 years ago.
patch for boost\concept\requires.hpp
broken.cpp (810 bytes ) - added by Stefan van Kessel <van_kessel@…> 12 years ago.
example code that breaks
pathfile2.patch (1.4 KB ) - added by Stefan van Kessel <van_kessel@…> 12 years ago.
Removed unncessary decltype. Now works at least on msvc10 and msvc9
patchfile3.patch (1.3 KB ) - added by Stefan van Kessel <van_kessel@…> 12 years ago.
removed unneccsary macros, added value enum member to template to make sure value of _requires_ gets evaluated in absence of decltype(...::value), changed PP condition to use BOOST_TESTED_AT

Download all attachments as: .zip

Change History (4)

by Stefan van Kessel <van_kessel@…>, 12 years ago

Attachment: patchfile.patch added

patch for boost\concept\requires.hpp

by Stefan van Kessel <van_kessel@…>, 12 years ago

Attachment: broken.cpp added

example code that breaks

by Stefan van Kessel <van_kessel@…>, 12 years ago

Attachment: pathfile2.patch added

Removed unncessary decltype. Now works at least on msvc10 and msvc9

by Stefan van Kessel <van_kessel@…>, 12 years ago

Attachment: patchfile3.patch added

removed unneccsary macros, added value enum member to template to make sure value of _requires_ gets evaluated in absence of decltype(...::value), changed PP condition to use BOOST_TESTED_AT

Note: See TracTickets for help on using tickets.