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]

c++/708: useless warning for legal code



>Number:         708
>Category:       c++
>Synopsis:       useless warning for legal code
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 29 15:36:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     sebor@roguewave.com
>Release:        2.95.2
>Organization:
>Environment:

>Description:
The code below generates a warning, presumably alerting the
programmer to the relatively recently implemented dependent
name lookup rules. IMO, warnings should not be issued for
legal code unless explicitly requested as they often force
people to work around them in cumbersome ways, making
writing portable code unnecessarily difficult.

t.cpp:13: warning: lookup of `V' finds `typedef typename T::V B<T>::V'
t.cpp:13: warning:   instead of `typename B<T>::C::V' from dependent base class
t.cpp:13: warning:   (use `typename C::V' if that's what you meant)
>How-To-Repeat:
$ cat << EOF > t.cpp && g++ -c t.cpp
template <class T>
struct A
{
    typedef T V;
};

template <class T>
struct B
{
    typedef typename T::V V;

    struct C: A<V> {
        typedef A<V> X;
    };
};
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:

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