This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/53578] New: include/ext/concurrence.h relies on ill-formed narrowing conversions


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53578

             Bug #: 53578
           Summary: include/ext/concurrence.h relies on ill-formed
                    narrowing conversions
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: richard-gccbugzilla@metafoo.co.uk


>From around line 271 of ext/concurrence.h:

// matches a gthr-win32.h recursive mutex
template<typename _Rm>
static typename __enable_if<sizeof(&_Rm::sema), void>::__type
_S_destroy(_Rm* __mx)

This SFINAE device doesn't work in Clang in C++11 mode, because the sizeof
expression evaluates to a value greater than one, and thus the implicit
conversion to bool for the first template parameter is a narrowing conversion.

I assume g++ will hit this too once it adds support for the narrowing check in
converted constant expressions.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]