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]
Other format: [Raw text]

[Bug c++/11694] Template member class of template class mix-up


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11694



------- Additional Comments From pinskia at physics dot uc dot edu  2003-07-28 14:08 -------
icc 6.0 rejects it with strict turned on (-Xc):
tin:~/src/gnu/gcctest>/opt/intel/compiler60/ia32/bin/icc pr11694.cc -Xc
pr11694.cc
pr11694.cc(21): error: nontype "foo<A, B>::helper [with A=A, B=A]" is not a template
    typedef base_type::helper<1> helper_type;
                       ^

pr11694.cc(25): error: identifier "_a" is undefined
    virtual int doit() { return _help.doit(_a,_b); }
                                           ^

pr11694.cc(25): error: identifier "_b" is undefined
    virtual int doit() { return _help.doit(_a,_b); }
                                              ^

pr11694.cc(36): error: identifier "_a" is undefined
    int doit() { return _helper->doit(_a,_b); }
                                      ^

pr11694.cc(36): error: identifier "_b" is undefined
    int doit() { return _helper->doit(_a,_b); }
                                         ^

compilation aborted for pr11694.cc (code 2)


The mainline (20030728) of GCC rejects it also:

pr11694.cc:21: error: ISO C++ forbids declaration of `helper' with no type
pr11694.cc:21: error: cannot declare member `foo<A, A>::helper' within `bar<A>'
pr11694.cc:21: error: expected `;'
pr11694.cc:22: error: `helper_type' does not name a type
pr11694.cc: In constructor `bar<A>::bar(const A&)':
pr11694.cc:24: error: class `bar<A>' does not have any field named `_help'
pr11694.cc: In member function `virtual int bar<A>::doit()':
pr11694.cc:25: error: `_help' undeclared (first use this function)
pr11694.cc:25: error: (Each undeclared identifier is reported only once for 
   each function it appears in.)
pr11694.cc:25: error: `_a' undeclared (first use this function)
pr11694.cc:25: error: `_b' undeclared (first use this function)
pr11694.cc: In member function `int baz<A>::doit()':
pr11694.cc:36: error: `_a' undeclared (first use this function)
pr11694.cc:36: error: `_b' undeclared (first use this function)
pr11694.cc: At global scope:
pr11694.cc: In instantiation of `baz<double>':
pr11694.cc:49:   instantiated from here
pr11694.cc:33: error: no type named `helper_type' in `struct bar<double>'
pr11694.cc:34: error: no type named `helper_type' in `struct bar<double>'
pr11694.cc: In constructor `baz<A>::baz() [with A = double]':
pr11694.cc:49:   instantiated from here
pr11694.cc:35: error: no type named `helper_type' in `struct bar<double>'
pr11694.cc:35: error: `_helper' undeclared (first use this function)
pr11694.cc: In member function `int baz<A>::doit() [with A = double]':
pr11694.cc:50:   instantiated from here
pr11694.cc:36: error: `_helper' undeclared (first use this function)

GCC 2.95.3 also rejects it:

pr11694.cc: In method `bar<double>::bar(const double &)':
pr11694.cc:46:   instantiated from here
pr11694.cc:24: no matching function for call to `foo<double,B>::helper<1>::helper 
(foo<double,B>::helper<1>)'
pr11694.cc: In method `int bar<double>::doit()':
pr11694.cc:47:   instantiated from here
pr11694.cc:25: no matching function for call to `foo<double,B>::helper<1>::doit (double &, 
double &)'
pr11694.cc: In method `baz<double>::baz()':
pr11694.cc:49:   instantiated from here
pr11694.cc:35: invalid use of undefined type `struct foo<double,B>::helper<1>'
pr11694.cc:8: forward declaration of `struct foo<double,B>::helper<1>'
pr11694.cc: In method `int baz<double>::doit()':
pr11694.cc:50:   instantiated from here
pr11694.cc:36: no matching function for call to `foo<double,B>::helper<1>::doit (double &, 
double &)'


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