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

            Bug ID: 122752
           Summary: g++-15: Compilation error about class not being a
                    non-union class type for valid C++ code
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: foss at grueninger dot de
  Target Milestone: ---

The recently version of Debian's g++ caused compilation errors in some packages
during rebuilds. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1120951

Same happens with latest 16.0 trunk version with Godbolt
https://godbolt.org/z/xodooafea for this reduced C++ program:

#include <set>

template <class S>
class A
{
  typedef S VertexSet;

public:
  typename VertexSet::size_type size();

private:
  VertexSet vertices_;
};

template <class S>
inline typename A<S>::VertexSet::size_type A<S>::size()
{
  return vertices_.size();
}

int main()
{
  A<std::set<int>> a;
  return a.size();
}

with the error:

<source>:16:55: error: 'class A<S>::VertexSet' resolves to 'A<S>::VertexSet',
which is not a non-union class type [-Wtemplate-body]
   16 | inline typename A<S>::VertexSet::size_type A<S>::size()
      |                                                       ^
Compiler returned: 1

With older version of g++ 15 is compiled without an error.

Reply via email to