[LLVMbugs] [Bug 12106] New: New trunk compiler crash while compiling begin()/end() for range-based-for (was ok in 3.0)
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Feb 27 21:20:09 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=12106
Bug #: 12106
Summary: New trunk compiler crash while compiling begin()/end()
for range-based-for (was ok in 3.0)
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: C++0x
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: kfmfe04 at gmail.com
CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
Classification: Unclassified
In 3.0, this snippet compiled fine.
In 3.1 (trunk 151577), the compiler crashes.
I am running on Lubuntu oneiric amd64.
The detailed report is here:
http://stackoverflow.com/questions/9475486/range-based-for-implementation-compiles-in-g-but-not-in-clang
Snippet is here:
template< typename E >
class Enum
{
public:
Enum() : m_e( E::Last ) { }
Enum( E t ) : m_e( t ) { }
E operator()() const
{
return m_e;
}
public:
class Iterator
{
public:
Iterator( int val ) : m_val( val ) { }
E operator*( void ) const
{
return (E) m_val;
}
void operator++( void )
{
++m_val;
}
bool operator!=( Iterator rhs ) const
{
return m_val != rhs.m_val;
}
private:
int m_val;
};
private:
E m_e;
};
enum class eCOLORS
{
kBLUE=0, kGREEN, kRED, kPURPLE,
First=kBLUE, Last=kPURPLE
};
Enum<eCOLORS>::Iterator begin(const Enum<eCOLORS>& b)
{
return Enum<eCOLORS>::Iterator( (int)(eCOLORS::First ));
}
Enum<eCOLORS>::Iterator end(const Enum<eCOLORS>& b)
{
return Enum<eCOLORS>::Iterator( (int)(eCOLORS::Last ));
}
int main()
{
Enum<eCOLORS> e;
// for( const auto x : Enum<eCOLORS>() )
for( auto it=begin(e);
it!=end(e); ++it )
{
}
}
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list