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: Paul Pluzhnikov
Subject: Re: error when working with with protected attributes in template classes
Date: Mon, 02 Jun 2008 21:46:53 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

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,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

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