Foo(300) = Foo(500); Why does a compiler compile that?
From: Alex Vinokur (alexvn_at_big-foot.com)
Date: 01/30/05
- Next message: Alf P. Steinbach: "Re: What's the difference betwwen explicit instantiaion and explicit specialization?"
- Previous message: Mariano López: "Re: VC++ project crashes in Windows 9x"
- Next in thread: Ivan Vecerina: "Re: Foo(300) = Foo(500); Why does a compiler compile that?"
- Reply: Ivan Vecerina: "Re: Foo(300) = Foo(500); Why does a compiler compile that?"
- Reply: Matthew Schaefer: "Re: Foo(300) = Foo(500); Why does a compiler compile that?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 30 Jan 2005 11:48:10 +0200
Compiler GNU gpp.exe (GCC) 3.4.1
Foo(300) = Foo(500); // Foo(300) is const. Why does a compiler compile that?
------ foo.cpp ------
struct Foo
{
explicit Foo(int) {}
Foo& operator= (const Foo&)
{
return *this;
}
};
int main()
{
Foo var1(100);
const Foo var2(200);
var1 = Foo(500);
Foo(300) = Foo(500); // Foo(300) is const. Why does a compiler compile that?
// var2 = Foo(500); // A compiler doesn't compile that
return 0;
}
---------------------
--
Alex Vinokur
email: alex DOT vinokur AT gmail DOT com
http://mathforum.org/library/view/10978.html
http://sourceforge.net/users/alexvn
- Next message: Alf P. Steinbach: "Re: What's the difference betwwen explicit instantiaion and explicit specialization?"
- Previous message: Mariano López: "Re: VC++ project crashes in Windows 9x"
- Next in thread: Ivan Vecerina: "Re: Foo(300) = Foo(500); Why does a compiler compile that?"
- Reply: Ivan Vecerina: "Re: Foo(300) = Foo(500); Why does a compiler compile that?"
- Reply: Matthew Schaefer: "Re: Foo(300) = Foo(500); Why does a compiler compile that?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|