Re: Strange error! Compiler problem? Or code problem?!!!!!!!
From: Pedro Miguel Carvalho (*SPAM*BLOCK**Pedro_MCLX_at_sapo.pt)
Date: 10/25/04
- Next message: Victor Bazarov: "Re: Call Stack"
- Previous message: Phlip: "Re: C++ sucks for games"
- In reply to: Pedro Miguel Carvalho: "Strange error! Compiler problem? Or code problem?!!!!!!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 25 Oct 2004 15:06:18 +0100
Ignore it!
I'm having a strange day, no special cases allowed :-).
Pedro Carvalho
"Pedro Miguel Carvalho" <*SPAM*BLOCK**Pedro_MCLX@sapo.pt> wrote in message
news:417cf195$0$12624$a729d347@news.telepac.pt...
| Greetings.
|
| The following code does not compile and I can't see why! I'm using
| C++Builder v6.0 (build 10.160).
|
| <code>
| #include <vector>
|
| class test
| {
| bool Fixed( unsigned int I ) const;
| bool& Fixed( unsigned int I );
|
| private:
|
| std::vector<bool> pFixed;
|
| };
|
| bool test::Fixed( unsigned int I ) const
| {
| return pFixed[I];
| }
|
| bool& test::Fixed( unsigned int I )
| {
| return pFixed[I]; // error: [C++ Error] test.cpp(21): E2357 Reference
| initialized with 'bool', needs lvalue of type 'bool'
| }
| </code>
|
| If the bool's are replace with int,float,double,a struct, a class, a enum
it
| compiles and works correctly.
| The following code <code> pFixed[I] = true; </code> also works so
| "pFixed[I]" is a lvalue.
|
| Is seems to be a compiler error but how can this error go unnoticed?
|
| Thanks,
| Pedro Carvalho
- Next message: Victor Bazarov: "Re: Call Stack"
- Previous message: Phlip: "Re: C++ sucks for games"
- In reply to: Pedro Miguel Carvalho: "Strange error! Compiler problem? Or code problem?!!!!!!!"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|