[Bug c++/71193] New: [6/7 Regression] error: invalid use of incomplete type

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu May 19 10:08:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71193

            Bug ID: 71193
           Summary: [6/7 Regression] error: invalid use of incomplete type
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

Hello.

Starting from r236221, we report a new error for the following snippet (reduced
from Chromium):

$ cat tc.ii
class Heap;
class A {
public:  
  Heap *m_fn1();
};
template <typename> class B : A {
  void m_fn2() { m_fn1()->HashSeed; }
};

$ g++ tc.ii
tc.ii: In member function ‘void B< <template-parameter-1-1> >::m_fn2()’:
tc.ii:7:25: error: invalid use of incomplete type ‘class Heap’
   void m_fn2() { m_fn1()->HashSeed; }
                         ^~
tc.ii:1:7: note: forward declaration of ‘class Heap’
 class Heap;
       ^~~~

GCC 5.3.1 works fine, as well as clang++ 3.7.0

Thanks,
Martin


More information about the Gcc-bugs mailing list