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]

Re: g++ 2.7.2.3 says «Unterminated string» ininline function containing terminated string with letters above 127d


> I also discovered another possible bug. I may be abusing the C++
> language, but I think it is a bug either way:
> 
> class c {
>   const int MinValue = -100;
>   const int MaxValue = +200;
> };
> 
> Compiled with gcc -Wall -c, gcc says:
> morebugs.cc:3: field initializer is not constant
> 
> If I remove the (redundant) + before 200, the code compiles OK.
> 200 is the same as +200, and in my opinion so should the compiler
> think.

gcc 2.95.2 correctly says

a.cc:2: ANSI C++ forbids initialization of member `MinValue'
a.cc:2: making `MinValue' static
a.cc:3: ANSI C++ forbids initialization of member `MaxValue'
a.cc:3: making `MaxValue' static

whether you have the redundant plus or not. I really recommend
updating your compiler - there is no point in reporting bugs for g++
2.7.

Regards,
Martin


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