public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/7699: Inner class scopting not working correctly for function prototype matching
@ 2002-09-13  9:48 lerdsuwa
  0 siblings, 0 replies; 2+ messages in thread
From: lerdsuwa @ 2002-09-13  9:48 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rob

Synopsis: Inner class scopting not working correctly for function prototype matching

State-Changed-From-To: open->closed
State-Changed-By: lerdsuwa
State-Changed-When: Fri Sep 13 09:48:26 2002
State-Changed-Why:
    Not a bug.  You need the 'typename' keyword in the following places:
           typename A<N>::B operator*();
    and
           template <typename N>
           typename A<N>::B A<N>::C::D::operator*()

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7699


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/7699: Inner class scopting not working correctly for function prototype matching
@ 2002-08-23  6:36 rob
  0 siblings, 0 replies; 2+ messages in thread
From: rob @ 2002-08-23  6:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7699
>Category:       c++
>Synopsis:       Inner class scopting not working correctly for function prototype matching
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Aug 23 06:36:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     rob@mve.com
>Release:        gcc 3.1
>Organization:
>Environment:
Red Hat Linux 7.3 on x86 Dual P4 Xeon 2.4 GHz
Linux version 2.4.18-5smp (bhcompile@daffy.perf.redhat.com) (gcc version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)) #1 SMP Mon Jun 10 15:19:40 EDT 2002
>Description:
With multiple levels of inner (nested) classes within an outer class template, attempting to return an instance of one inner class from a member function of an inner, inner class causes a compilation failure with a series of related errors. There is a failure to match function prototypes even though one of the candidates listed is identical to that requested, and all class names have been fully scoped.

In the example file attached the member function of a second degree inner class is attempting to return an object of a first degree inner class, all of which are in the same outer class template. Example class layout:

template <typename N>
class A
{
  class B
  {
  };

  class C
  {
    class D
    {
       A<N>::B operator*(); // Member function declaration
    };
  };
};

template <typename N>
A<N>::B A<N>::C::D::operator*() // Causes errors
{
   return A<N>::B();
}
Note that the same source code provided in the attached file works perfectly with the SGI MipPro C++ compiler. The attached file contains the example on which I discovered the issue. The same problem occurs twice in this code.

The errors reported on my system are:

In file included from main.cxx:8:
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:1373: prototype
   for `Grid2D<N>::PointReference
   Grid2D<N>::FaceReference::VertexCirculator::operator*()' does not match any
   in class `Grid2D<N>::FaceReference::VertexCirculator'
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:257: candidate
   s are: Point<N> Grid2D<N>::FaceReference::VertexCirculator::operator*()
   const
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:256:
         Grid2D<N>::PointReference
   Grid2D<N>::FaceReference::VertexCirculator::operator*()
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:1373: template
   definition of non-template `Grid2D<N>::PointReference
   Grid2D<N>::FaceReference::VertexCirculator::operator*()'
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:1453: prototype
   for `Grid2D<N>::EdgeReference
   Grid2D<N>::FaceReference::EdgeCirculator::operator*()' does not match any in
   class `Grid2D<N>::FaceReference::EdgeCirculator'
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:287: candidate
   s are: Edge<N> Grid2D<N>::FaceReference::EdgeCirculator::operator*() const
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:286:
         Grid2D<N>::EdgeReference
   Grid2D<N>::FaceReference::EdgeCirculator::operator*()
/homes/rob/dev/products/nmove/main/model/egs/grid2d/inc/Grid2D.h:1453: template
   definition of non-template `Grid2D<N>::EdgeReference
   Grid2D<N>::FaceReference::EdgeCirculator::operator*()'
>How-To-Repeat:
The following command line reproduces the error :

/usr/local/gcc3.1/bin/g++ -fPIC -ftemplate-depth-50 -Wno-deprecated -g   -DMVE_DEBUG -DMVE_LINUX -DMVE_WFM   -DMVE_NM  -DMVE_QT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -DMVE_CGAL -DMVE_USE_CGAL -DDEBUG -DMVE_BOOST -DMVE_BOOST_VERSION=1280   -DMVE_LINUX_GCC3 -DMVE_STD  -I. -I/homes/rob/dev/products/nmove/main -I/homes/rob/utils_install/LINUX/qt-3.0.3-LINUX.DEBUG.GCC3/include -I/homes/rob/utils_install/LINUX/cgal-2.4-LINUX.DEBUG.GCC3/include/CGAL/config/i686_Linux-2.4.18-5smp_g++-3.1.0 -I/homes/rob/utils_install/LINUX/cgal-2.4-LINUX.DEBUG.GCC3/include -I/homes/rob/utils_install/LINUX/boost-1_28_0-LINUX.DEBUG.GCC3  -c main.cxx -o obj_files/LINUX.DEBUG.GCC3/main.o


>Fix:
None found
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-13 16:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-13  9:48 c++/7699: Inner class scopting not working correctly for function prototype matching lerdsuwa
  -- strict thread matches above, loose matches on Subject: below --
2002-08-23  6:36 rob

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).