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

            Bug ID: 78615
           Summary: error: cannot decrement a pointer to incomplete type
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jason at gcc dot gnu.org
  Target Milestone: ---

Starting from r240889, I can't compile following test-case:

$ cat tc.ii
template <typename> class QList
{
public:
  ~QList ();
  void node_destruct ();
};
class A
{
  int *provider ();
};
class B
{
public:
  B (A *);
  QList<int> m_magicMatchers;
};
template <typename T>
void
QList<T>::node_destruct ()
{
  struct QListNode *a;
  --a;
}
template <typename T> QList<T>::~QList () { node_destruct(); }
int *
A::provider ()
{
  new B (this);
}

g++ tc.ii -c -std=c++1z
tc.ii: In instantiation of ‘void QList< <template-parameter-1-1>
>::node_destruct() [with <template-parameter-1-1> = int]’:
tc.ii:24:58:   required from ‘QList< <template-parameter-1-1> >::~QList() [with
<template-parameter-1-1> = int]’
tc.ii:11:7:   required from here
tc.ii:22:3: error: cannot decrement a pointer to incomplete type ‘QList<
<template-parameter-1-1> >::node_destruct() [with <template-parameter-1-1> =
int]::QListNode’
   --a;
   ^~~

Reply via email to