Will error C2468 be removed 
Author Message
 Will error C2468 be removed

The following code generates a C2468 error ('new' : cannot allocate
'const'/'volatile' objects (type is 'const int')) with both MSVC 6 and
VS.Net:

int main()
{
   new const int;

   return 0;

Quote:
}

However, this code is well-formed (even if it does leak). In the days
of the ARM it wasn't legal to use new to create an object that was
const or volatile, but nowadays it is - see 5.2.4/1 in the standard.

Will this be fixed in the next version of the compiler?

- Alan



Fri, 07 Jan 2005 19:34:56 GMT  
 Will error C2468 be removed


Quote:
> The following code generates a C2468 error ('new' : cannot allocate
> 'const'/'volatile' objects (type is 'const int')) with both MSVC 6 and
> VS.Net:

> int main()
> {
>    new const int;

>    return 0;
> }

> However, this code is well-formed (even if it does leak). In the days
> of the ARM it wasn't legal to use new to create an object that was
> const or volatile, but nowadays it is - see 5.2.4/1 in the standard.

> Will this be fixed in the next version of the compiler?

> - Alan

Yes, the upcoming release sometimes called VC7.1 compiles this code w/o
error.

Jason Shirk
VC++ Compiler Team



Sat, 08 Jan 2005 02:05:14 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. yes I am willing to

2. am I parse error

3. I am recieving a compiler error

4. I AM WILLING TO PAY, PLEASE READ AND HELP ME!!!

5. I am new to programming and am lost

6. Please help me - I am getting linker error !!!

7. Why I am getting Error C2091: function returns function

8. Newbie:- Why am i getting a linking error

9. Linker error - which library am I missing ?

10. Don't understand why I am getting the C2236 error

11. Why am I getting this error - compiler bug?

12. Anyone willing to help me learn arrays?

 

 
Powered by phpBB® Forum Software