Home Dashboard Directory Help
Search

C++ math functions too generic by Christian Rau


Status: 

Active


1
0
Sign in
to vote
Type: Bug
ID: 776471
Opened: 1/14/2013 4:45:23 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

In order to provide the additional overloads for the mathematical functions, as required by the C++11 standard section 26.8 [c.math] paragraph 11, the VS 2012 standard library implementation defines general function templates for all 2-argument mathematical functions, resolving to a common return type.

However those templates can be instantiated with arbitrary types and not just the builtin arithmetic types, which I think is erroneous behavior. At least it is inconsistent to the 1-argument functions, which provide overloads only for the builtin arithmetic types.(Although the standard wording is not completely clear about this, there is already Standard Library Defect Report 2086 regarding this unclear wording. A solution is on its way to be incorporated into the standard, which finally requires those additional overloads to be only defined for arithmetic types, which seemed to have been the original intent all along.)

A simple 'std::enable_if' (or a similar SFINAE solution) checking for 'std::is_arithmetic' would solve the problem. This is already done by the current implementation for the 1-argument functions, which have an appropriate 'std::enable_if' checking for 'std::is_integral'.
Details
Sign in to post a comment.
Posted by Microsoft on 4/29/2013 at 5:42 PM
Hi again,

We've fixed this bug, and the fix will be available in VC12.

Note: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 2/21/2013 at 2:05 PM
Hi,

Thanks for reporting this bug. I wanted to let you know what's happening with it. I'm still keeping track of it, but it's been resolved as "Deferred" because we may not have time to fix it in VC12. (Note: VC8 = VS 2005, VC9 = VS 2008, VC10 = VS 2010, VC11 = VS 2012.)

Note: Connect doesn't notify me about comments. If you have any further questions, please E-mail me.

Stephan T. Lavavej
Senior Developer - Visual C++ Libraries
stl@microsoft.com
Posted by Microsoft on 1/14/2013 at 9:28 PM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/14/2013 at 4:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.