[Bug c++/104008] New: New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion

ahornby at fb dot com gcc-bugzilla@gcc.gnu.org
Thu Jan 13 14:20:09 GMT 2022


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

            Bug ID: 104008
           Summary: New g++ folly compile error with gcc 11.x. Bisected to
                    PR99445 c++: Alias template in pack expansion
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ahornby at fb dot com
  Target Milestone: ---

Created attachment 52178
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52178&action=edit
gzipped preprocessed source used for the bisect

When compiling folly on Fedora 35 with gcc from the included 11.2.1-7 package,
I found that the badge_test code fails to compile,  whereas it builds fine with
gcc 10.x and with the fedora 35 clang (13.0.0-3.fc35)).

Bisecting from https://gcc.gnu.org/git/gcc.git  with pre-processed source
indicates problem introduced in commit:
[a2531859bf5bf6cf1f29c0dca85fd26e80904a5d] c++: Alias template in pack
expansion [PR99445] (mirror at
https://github.com/gcc-mirror/gcc/commit/a2531859bf5bf6cf1f29c0dca85fd26e80904a5d)

I've also tested latest master and problem present there as well.

Bisected with commands, (bisection script below)
git bisect start basepoints/gcc-12 basepoints/gcc-11
git bisect run ~/local/bisect/gxx_bisect.sh

Example  of the problem from a folly build along with the command line I got
preprocessed source from is in 
https://github.com/facebook/folly/commit/af966d2ce25c14c96373bf39c8ae2b406219ffb4

Error looks like:

'/home/alex/local/bisect/test/0cc79337ad265aabccab63882a810f9dc509a9d0/build'
In file included from /home/alex/local/folly/folly/lang/test/BadgeTest.cpp:19:
/home/alex/local/folly/folly/lang/Badge.h: In instantiation of ‘class
folly::any_badge<{anonymous}::FriendClass, {anonymous}::OtherFriendClass>’:
/home/alex/local/folly/folly/lang/test/BadgeTest.cpp:38:40:   required from
here
/home/alex/local/folly/folly/lang/Badge.h:99:18: error: expansion pattern
‘folly::StrictDisjunction<std::is_same<OtherHolders, Holders>...>’ contains no
parameter packs
   99 |   /* implicit */ any_badge(any_badge<OtherHolders...>) noexcept {}
      |                  ^~~~~~~~~
/home/alex/local/folly/folly/lang/Badge.h: In instantiation of ‘class
folly::any_badge<{anonymous}::FriendClass, {anonymous}::OtherFriendClass,
{anonymous}::DummyClass>’:
/home/alex/local/folly/folly/lang/test/BadgeTest.cpp:39:53:   required from
here
/home/alex/local/folly/folly/lang/Badge.h:99:18: error: expansion pattern
‘folly::StrictDisjunction<std::is_same<OtherHolders, Holders>...>’ contains no
parameter packs
/home/alex/local/folly/folly/lang/test/BadgeTest.cpp: In static member function
‘static void {anonymous}::ProtectedClass::subset({anonymous}::SubsetBadges)’:
/home/alex/local/folly/folly/lang/test/BadgeTest.cpp:39:54: error: cannot
convert ‘any_badge<{anonymous}::FriendClass, {anonymous}::OtherFriendClass>’ to
‘any_badge<{anonymous}::FriendClass, {anonymous}::OtherFriendClass,
{anonymous}::DummyClass>’
   39 |   static void subset(SubsetBadges badges) { superset(badges); }
      |                                                      ^~~~~~
      |                                                      |
      |                                                     
any_badge<{anonymous}::FriendClass, {anonymous}::OtherFriendClass>
/home/alex/local/folly/folly/lang/test/BadgeTest.cpp:40:24: note:  
initializing argument 1 of ‘static void
{anonymous}::ProtectedClass::superset({anonymous}::SupersetBadges)’
   40 |   static void superset(SupersetBadges) {}
      |                        ^~~~~~~~~~~~~~
In file included from /home/alex/local/folly/folly/lang/test/BadgeTest.cpp:19:
/home/alex/local/folly/folly/lang/Badge.h: In instantiation of ‘class
folly::any_badge<{anonymous}::FriendClass>’:
/home/alex/local/folly/folly/lang/test/BadgeTest.cpp:47:35:   required from
here
/home/alex/local/folly/folly/lang/Badge.h:99:18: error: expansion pattern
‘folly::StrictDisjunction<std::is_same<OtherHolders, Holders>...>’ contains no
parameter packs
   99 |   /* implicit */ any_badge(any_badge<OtherHolders...>) noexcept {}
      |                  ^~~~~~~~~
Exited with 0


Bisection script was:

#!/bin/sh
# adapted from http://moxielogic.org/blog/bisecting-gcc.html
# Test with:
#   cd local/gcc #(or whereever gcc git repo is)
#   ./bisect/gxx_bisect.sh
# Run with:
#   git bisect run ~/local/bisect/gxx_bisect.sh

# git clone of the gcc tree
GCCSRC="$HOME/local/gcc"

# pre-processed test case
TESTSRC="$HOME/local/bisect/bisect_source.i"

COMMIT=`git rev-parse HEAD`

# Where to put gcc build and install dirs
testdir="$HOME/local/bisect/test/$COMMIT"

mkdir -p "$testdir/build"
mkdir -p "$testdir/install"

# configure for C & C++
(cd "$testdir/build" &&
 $GCCSRC/configure --prefix="$testdir/install" --enable-languages=c,c++
--with-system-zlib --disable-multilib --disable-libsanitizer
--disable-bootstrap &&
 make -j 32 && make -j 32 install)

cxxbin="$testdir/install/bin/g++"

if test -x "$cxxbin"; then
  # build test case
  if "$cxxbin" -std=gnu++17 -c "$TESTSRC"; then
    # everything's fine
    exit 0
  fi
  # gcc can return exit codes outside of git's acceptable range, so...
  echo "Exited with $?" 1>&2
  exit 1
else
  # No binary, skip broken builds with special 125 exit code
  exit 125
fi


More information about the Gcc-bugs mailing list