help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: error when working with with protected attributes in template classe


From: Gelu Ionescu
Subject: Re: error when working with with protected attributes in template classes
Date: Wed, 04 Jun 2008 09:42:18 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.2) Gecko/20040804 Netscape/7.2 (ax)

Hello Paul,

Yes is true, "This has nothing to do with the attribute being protected you get exact same error if it is made pulibc."

But, my hope is to install a software "Xvision" which was already installed on different platforms working on several operating systems. I have also a different package which works fine on VisualC++ but the compilation fails on linux.

Can we consider this as a bug in gcc?

Presently, I am working in this environment:

gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)

Thanks in advance,





Paul Pluzhnikov wrote:
Gelu Ionescu <ionescu@lis.inpg.fr> writes:


When I try to use the protected attribute


This has nothing to do with the attribute being protected, you get
exact same error if it is made pulibc.


I am sure there is a flag in the gcc compiler which solves globally
this kind of situation.


There is no flag; your code is broken an must be fixed.
HP aCC issues the best diagnostics:

$ aCC -c t.cpp
Error (future) 641: "t.cpp", line 14 # Undeclared variable 'myT1'. A variable 
with the same name exists in a template base class, but is not visible according to the 
Standard lookup rules (See [temp.dep], 14.6.2(3) in the C++ Standard). You can make it
    visible by writing 'this->myT1'.
            {       t1* _t1 = myT1; // ERROR :'myT1' was not declared in this 
scope
^^^^ Error (future) 641: "t.cpp", line 15 # Undeclared variable 'myT2'. A variable with the same name exists in a template base class, but is not visible according to the Standard lookup rules (See [temp.dep], 14.6.2(3) in the C++ Standard). You can make it
    visible by writing 'this->myT2'.
                    t2* _t2 = myT2; // ERROR :'myT2' was not declared in this 
scope
^^^^ Warning: 2 future errors were detected and ignored. Add a '+p' option to detect and fix them before they become fatal errors in a future release. Behavior of this ill-formed program is not guaranteed to match that of a well-formed program

Cheers,


reply via email to

[Prev in Thread] Current Thread [Next in Thread]