stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Martin Sebor (JIRA)" <j...@apache.org>
Subject [jira] Created: (STDCXX-282) [MSVC 8.0] bogus ambiguity on overloaded template conversion operator
Date Fri, 01 Sep 2006 15:37:22 GMT
[MSVC 8.0] bogus ambiguity on overloaded template conversion operator
---------------------------------------------------------------------

                 Key: STDCXX-282
                 URL: http://issues.apache.org/jira/browse/STDCXX-282
             Project: C++ Standard Library
          Issue Type: Bug
          Components: External
         Environment: MSVC 7.0, 7.1, 8.0
            Reporter: Martin Sebor


The well-formed program below fails to compile with all recent versions of MSVC, including
8.0:

$ cat t.cpp && cl t.cpp
struct S {
    int x;

    template <class T> operator T& () { return (T&)x; }

    template <class T> operator T () const {
        return static_cast<T&>(*const_cast<S*>(this));
    }
};


int main ()
{
    S s = { 0 };

    return int (s);
}
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

t.cpp
t.cpp(16) : error C2440: '<function-style-cast>' : cannot convert from 'S' to 'int'
        No user-defined-conversion operator available that can perform this conversion, or
the operator cannot be called


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message