VC71 final beta - Reject valid C++ code snippet 
Author Message
 VC71 final beta - Reject valid C++ code snippet

Hello,

-------------------------------
struct Foo
{
    Foo* _f;

    Foo();
    void func(Foo* f);

Quote:
} Foo;

Foo::Foo() : _f(new Foo)
{}

void Foo::func(Foo* f)
{
    Foo* g;

Quote:
}

-------------------------------

This code snippet is legal because of 9.3p5 [class.mfct], which says that
names used in a member function definition (that is, in the
parameter-declaration-clause including default arguments, or in the member
function body, or, for a constructor function, in a mem-initializer
expression) is looked up as described in 3.4 (that is, exactly like it was
defined inside the definition of the class).

It fails to compile on VC++ final beta. The example reproduces three
different situations in which the compiler is confused:

- in the mem-initializer expression while defining the constructor
- in the parameter-declaration-clause while defining the member function
outside the class definition.
- in the member function body, while defining a local variable

Giovanni Bajo



Sun, 18 Sep 2005 23:24:15 GMT  
 VC71 final beta - Reject valid C++ code snippet

--------------------

Quote:

> Newsgroups: microsoft.public.dotnet.languages.vc
> Subject: VC71 final beta - Reject valid C++ code snippet

> Hello,

> -------------------------------
> struct Foo
> {
>     Foo* _f;

>     Foo();
>     void func(Foo* f);
> } Foo;

> Foo::Foo() : _f(new Foo)
> {}

> void Foo::func(Foo* f)
> {
>     Foo* g;
> }
> -------------------------------

> This code snippet is legal because of 9.3p5 [class.mfct], which says that
> names used in a member function definition (that is, in the
> parameter-declaration-clause including default arguments, or in the member
> function body, or, for a constructor function, in a mem-initializer
> expression) is looked up as described in 3.4 (that is, exactly like it
was
> defined inside the definition of the class).

> It fails to compile on VC++ final beta. The example reproduces three
> different situations in which the compiler is confused:

> - in the mem-initializer expression while defining the constructor
> - in the parameter-declaration-clause while defining the member function
> outside the class definition.
> - in the member function body, while defining a local variable

> Giovanni Bajo

Giovanni:

Thanks for reporting this bug.  We are tracking it (#73396) for future
compiler releases.

--
Siva Challa, Microsoft Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm



Thu, 22 Sep 2005 23:39:56 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. VC71 c++ internal compiler error (with very simple code)

2. Possible C++ bug .NET 2003 Final Beta

3. Bug in Visual C++ 7.1 Final Beta compiler.

4. Bugs in Visual C++ 2003 Final Beta

5. Profiling VC7/VC71 generated code

6. VC 2003 final beta

7. VS 2003 final beta C1001: another ICE

8. Missing .lib file in Everett Final Beta distribution???

 

 
Powered by phpBB® Forum Software