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 c++/13156] New: Greedy instantiation


The following fails to compile, but shouldn't.  You can see this by replacing 
the body of X's constructor with ";", which will cause compilation to succeed.

------

struct X
{
    template <class T>
    X(T const&) { T x = 1; }
};

template <class From, class To>
struct conv
{
    
    static char (& _m_check(...) )[2];
    static char _m_check(To);
    static From _m_from;

    enum {
        value = sizeof( _m_check(_m_from) ) == 1
    };
};

int x[conv<char*,X>::value ? 1 : -1];

-- 
           Summary: Greedy instantiation
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dave at boost-consulting dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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