public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/104008] New: New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
@ 2022-01-13 14:20 ahornby at fb dot com
  2022-01-13 14:55 ` [Bug c++/104008] [11/12 Regression] " jakub at gcc dot gnu.org
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: ahornby at fb dot com @ 2022-01-13 14:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
@ 2022-01-13 14:55 ` jakub at gcc dot gnu.org
  2022-01-13 17:28 ` redi at gcc dot gnu.org
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-01-13 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |jason at gcc dot gnu.org
   Target Milestone|---                         |11.3
            Summary|New g++ folly compile error |[11/12 Regression] New g++
                   |with gcc 11.x. Bisected to  |folly compile error with
                   |PR99445 c++: Alias template |gcc 11.x. Bisected to
                   |in pack expansion           |PR99445 c++: Alias template
                   |                            |in pack expansion

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
  2022-01-13 14:55 ` [Bug c++/104008] [11/12 Regression] " jakub at gcc dot gnu.org
@ 2022-01-13 17:28 ` redi at gcc dot gnu.org
  2022-02-01 15:59 ` marxin at gcc dot gnu.org
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: redi at gcc dot gnu.org @ 2022-01-13 17:28 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0
           Keywords|                            |rejects-valid
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=102869

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Possible dup of PR 102869

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
  2022-01-13 14:55 ` [Bug c++/104008] [11/12 Regression] " jakub at gcc dot gnu.org
  2022-01-13 17:28 ` redi at gcc dot gnu.org
@ 2022-02-01 15:59 ` marxin at gcc dot gnu.org
  2022-02-05 12:28 ` ahornby at fb dot com
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-01 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-02-01
             Status|UNCONFIRMED                 |WAITING
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Please provide pre-processed source file generated by gcc 10.

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
                   ` (2 preceding siblings ...)
  2022-02-01 15:59 ` marxin at gcc dot gnu.org
@ 2022-02-05 12:28 ` ahornby at fb dot com
  2022-02-05 12:32 ` ahornby at fb dot com
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: ahornby at fb dot com @ 2022-02-05 12:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Alex Hornby <ahornby at fb dot com> ---
Created attachment 52356
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52356&action=edit
preprocessed source from gcc 10.3.0

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
                   ` (3 preceding siblings ...)
  2022-02-05 12:28 ` ahornby at fb dot com
@ 2022-02-05 12:32 ` ahornby at fb dot com
  2022-02-05 12:33 ` ahornby at fb dot com
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: ahornby at fb dot com @ 2022-02-05 12:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Alex Hornby <ahornby at fb dot com> ---
Created attachment 52357
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52357&action=edit
preprocessed source from gcc 11.2.1 produced at same time as gcc 10.3.0
preprocessed source

captured at the same system state as the 10.3.0 pre-processed source from my
Fedora 35 system

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
                   ` (4 preceding siblings ...)
  2022-02-05 12:32 ` ahornby at fb dot com
@ 2022-02-05 12:33 ` ahornby at fb dot com
  2022-02-14 17:39 ` alex_700_95 at mail dot ru
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: ahornby at fb dot com @ 2022-02-05 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alex Hornby <ahornby at fb dot com> ---
(In reply to Alex Hornby from comment #3)
> Created attachment 52356 [details]
> preprocessed source from gcc 10.3.0

done, also captured the source from a failing 11.2.1 build at same system state

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error with gcc 11.x. Bisected to PR99445 c++: Alias template in pack expansion
  2022-01-13 14:20 [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
                   ` (5 preceding siblings ...)
  2022-02-05 12:33 ` ahornby at fb dot com
@ 2022-02-14 17:39 ` alex_700_95 at mail dot ru
  2022-02-22 10:03 ` [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf marxin at gcc dot gnu.org
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: alex_700_95 at mail dot ru @ 2022-02-14 17:39 UTC (permalink / raw)
  To: gcc-bugs

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

Aleksei Latyshev <alex_700_95 at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alex_700_95 at mail dot ru

--- Comment #6 from Aleksei Latyshev <alex_700_95 at mail dot ru> ---
Let me add a simplified reproducer for this bug:
https://godbolt.org/z/3ec1dW8YE

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (6 preceding siblings ...)
  2022-02-14 17:39 ` alex_700_95 at mail dot ru
@ 2022-02-22 10:03 ` marxin at gcc dot gnu.org
  2022-03-11 22:49 ` mpolacek at gcc dot gnu.org
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: marxin at gcc dot gnu.org @ 2022-02-22 10:03 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
            Summary|[11/12 Regression] New g++  |[11/12 Regression] New g++
                   |folly compile error with    |folly compile error since
                   |gcc 11.x. Bisected to       |r11-7931-ga2531859bf5bf6cf
                   |PR99445 c++: Alias template |
                   |in pack expansion           |
           Keywords|needs-reduction             |

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r11-7931-ga2531859bf5bf6cf.

Test-case:

template <typename...> struct conjunction;
template <typename...> struct disjunction;
template <typename, typename> struct is_same;
template <bool> struct enable_if;
template <bool _Cond> using enable_if_t = typename enable_if<_Cond>::type;
struct B;
struct __uniq_ptr_impl {
  struct _Ptr {
    using type = B *;
  };
  using pointer = _Ptr::type;
};
struct unique_ptr {
  using pointer = __uniq_ptr_impl::pointer;
  unique_ptr(pointer);
};
template <typename, typename... _Args> unique_ptr make_unique(_Args... __args)
{
  return new B(__args...);
}
template <typename T, typename... Ts>
using IsOneOf = disjunction<is_same<T, Ts>...>;
template <typename...> class any_badge;
struct badge {
  badge(any_badge<>);
  badge();
};
template <typename...> struct any_badge {
  template <typename... OtherHolders,
            enable_if_t<conjunction<IsOneOf<OtherHolders>...>::value>>
  any_badge();
};
struct B {
  B(badge);
  unique_ptr b_ = make_unique<B>(badge{});
};

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (7 preceding siblings ...)
  2022-02-22 10:03 ` [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf marxin at gcc dot gnu.org
@ 2022-03-11 22:49 ` mpolacek at gcc dot gnu.org
  2022-03-14 23:53 ` mpolacek at gcc dot gnu.org
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-11 22:49 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #8 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Since r11-7931, we strip_typedefs in TYPE_PACK_EXPANSION.  In this test that
results in IsOneOf<OtherHolders> being turned into disjunction<>, but then
make_pack_expansion -> find_parameter_packs_r won't find OtherHolders.

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (8 preceding siblings ...)
  2022-03-11 22:49 ` mpolacek at gcc dot gnu.org
@ 2022-03-14 23:53 ` mpolacek at gcc dot gnu.org
  2022-03-18 16:50 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-14 23:53 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (9 preceding siblings ...)
  2022-03-14 23:53 ` mpolacek at gcc dot gnu.org
@ 2022-03-18 16:50 ` cvs-commit at gcc dot gnu.org
  2022-03-18 16:51 ` [Bug c++/104008] [11 " mpolacek at gcc dot gnu.org
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-18 16:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The trunk branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:c7a6a32739d62deab03266e2b5449fce261b1ecb

commit r12-7710-gc7a6a32739d62deab03266e2b5449fce261b1ecb
Author: Marek Polacek <polacek@redhat.com>
Date:   Wed Mar 16 09:34:34 2022 -0400

    c++: alias template and empty parameter packs [PR104008]

    Zero-length pack expansions are treated as if no list were provided
    at all, that is, with

      template<typename...> struct S { };
      template<typename T, typename... Ts>
      void g() {
        S<std::is_same<T, Ts>...>;
      }

    g<int> will result in S<>.  In the following test we have something
    similar:

      template <typename T, typename... Ts>
      using IsOneOf = disjunction<is_same<T, Ts>...>;

    and then we have "IsOneOf<OtherHolders>..." where OtherHolders is an
    empty pack.  Since r11-7931, we strip_typedefs in TYPE_PACK_EXPANSION.
    In this test that results in "IsOneOf<OtherHolders>" being turned into
    "disjunction<>".  So the whole expansion is now "disjunction<>...".  But
    then we error in make_pack_expansion because find_parameter_packs_r won't
    find the pack OtherHolders.

    We strip the alias template because dependent_alias_template_spec_p says
    it's not dependent.  It it not dependent because this alias is not
    TEMPLATE_DECL_COMPLEX_ALIAS_P.  My understanding is that currently we
    consider an alias complex if it

    1) expands a pack from the enclosing class, as in

        template<template<typename... U> typename... TT>
        struct S {
          template<typename... Args>
          using X = P<TT<Args...>...>;
        };

       where the alias expands TT; or

    2) the expansion does *not* name all the template parameters, as in

        template<typename...> struct R;
        template<typename T, typename... Ts>
        using U = R<X<Ts>...>;

       where T is not named in the expansion.

    But IsOneOf is neither.  And it can't know how it's going to be used.
    Therefore I think we cannot make it complex (and in turn dependent) to fix
    this bug.

    After much gnashing of teeth, I think we simply want to avoid stripping
    the alias if the new pattern doesn't have any parameter packs to expand.

            PR c++/104008

    gcc/cp/ChangeLog:

            * tree.cc (strip_typedefs): Don't strip an alias template when
            doing so would result in losing a parameter pack.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/variadic-alias3.C: New test.
            * g++.dg/cpp0x/variadic-alias4.C: New test.

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (10 preceding siblings ...)
  2022-03-18 16:50 ` cvs-commit at gcc dot gnu.org
@ 2022-03-18 16:51 ` mpolacek at gcc dot gnu.org
  2022-03-18 18:58 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-18 16:51 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[11/12 Regression] New g++  |[11 Regression] New g++
                   |folly compile error since   |folly compile error since
                   |r11-7931-ga2531859bf5bf6cf  |r11-7931-ga2531859bf5bf6cf

--- Comment #10 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (11 preceding siblings ...)
  2022-03-18 16:51 ` [Bug c++/104008] [11 " mpolacek at gcc dot gnu.org
@ 2022-03-18 18:58 ` ppalka at gcc dot gnu.org
  2022-03-18 19:40 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-03-18 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=103769
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #11 from Patrick Palka <ppalka at gcc dot gnu.org> ---
FWIW it seems the new test g++.dg/cpp0x/variadic-alias3.C crashes when using
--param=hash-table-verification-limit=1000, similar to PR103769.

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (12 preceding siblings ...)
  2022-03-18 18:58 ` ppalka at gcc dot gnu.org
@ 2022-03-18 19:40 ` mpolacek at gcc dot gnu.org
  2022-03-21 19:40 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-18 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #11)
> FWIW it seems the new test g++.dg/cpp0x/variadic-alias3.C crashes when using
> --param=hash-table-verification-limit=1000, similar to PR103769.

I cannot reproduce that:

$ ./cc1plus -quiet variadic-alias3.C --param=hash-table-verification-limit=1000
# OK

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (13 preceding siblings ...)
  2022-03-18 19:40 ` mpolacek at gcc dot gnu.org
@ 2022-03-21 19:40 ` mpolacek at gcc dot gnu.org
  2022-03-28 15:04 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2022-03-21 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #13 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ah, need -fchecking=2:

$ ./cc1plus -quiet variadic-alias3.C -Iinclude
--param=hash-table-verification-limit=1000 -fchecking=2
hash table checking failed: equal operator returns true for a pair of values
with a different hash value
variadic-alias3.C: In instantiation of ‘struct any_badge<>’:
variadic-alias3.C:44:10:   required from ‘unique_ptr make_unique(_Args ...)
[with <template-parameter-1-1> = B; _Args = {badge}]’
variadic-alias3.C:40:33:   required from here
variadic-alias3.C:33:3: internal compiler error: in hashtab_chk_error, at
hash-table.cc:137
   33 |   any_badge();
      |   ^~~~~~~~~
0x2ec90b2 hashtab_chk_error()
        /home/mpolacek/src/gcc/gcc/hash-table.cc:137
0xe60acd hash_table<spec_hasher, false, xcallocator>::verify(spec_entry*
const&, unsigned int)
        /home/mpolacek/src/gcc/gcc/hash-table.h:1036
0xdf449f lookup_template_class_1
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:9954
0xdf6cd6 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:10309
0xe0552c tsubst_aggr_type
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:13697
0xe12f43 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:15607
0xe16e9e tsubst_qualified_id
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:16585
0xe2d0bc tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:20289
0xe29494 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:19419
0xe001f9 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:12373
0xe045f8 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:13467
0xe05375 tsubst_aggr_type
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:13679
0xe15272 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:16148
0xe14629 tsubst(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:15904
0xe1b4fd tsubst_copy
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:17398
0xe32aca tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:21327
0xe29494 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:19419
0xe001f9 tsubst_template_arg(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:12373
0xe045f8 tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:13467
0xe0451d tsubst_template_args(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.cc:13449

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (14 preceding siblings ...)
  2022-03-21 19:40 ` mpolacek at gcc dot gnu.org
@ 2022-03-28 15:04 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:24 ` jason at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-28 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:fc50d9a252c89c1bac78192bd0884ff23f2bf48b

commit r12-7857-gfc50d9a252c89c1bac78192bd0884ff23f2bf48b
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 25 13:13:35 2022 -0400

    c++: hash table ICE with variadic alias [PR105003]

    For PR104008 we thought it might be enough to keep strip_typedefs from
    removing this alias template specialization, but this PR demonstrates that
    other parts of the compiler also need to know to consider it dependent.

    So, this patch changes complex_alias_template_p to no longer consider
    template parameters used when their only use appears in a pack expansion,
    unless they are the parameter packs being expanded.

    To do that I also needed to change it to use cp_walk_tree instead of
    for_each_template_parm.  It occurs to me that find_template_parameters
    should probably also use cp_walk_tree, but I'm not messing with that now.

            PR c++/105003
            PR c++/104008
            PR c++/102869

    gcc/cp/ChangeLog:

            * pt.cc (complex_alias_template_r): walk_tree callback, replacing
            uses_all_template_parms_r, complex_pack_expansion_r.
            (complex_alias_template_p): Adjust.
            * tree.cc (strip_typedefs): Revert r12-7710 change.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/variadic-alias6.C: New test.
            * g++.dg/cpp0x/variadic-alias7.C: New test.

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (15 preceding siblings ...)
  2022-03-28 15:04 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:24 ` jason at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-12 20:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:00e7d6e66638b8d2d93ff6659a140f8b3cf37aeb

commit r11-9827-g00e7d6e66638b8d2d93ff6659a140f8b3cf37aeb
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Mar 25 13:13:35 2022 -0400

    c++: hash table ICE with variadic alias [PR105003]

    For PR104008 we thought it might be enough to keep strip_typedefs from
    removing this alias template specialization, but this PR demonstrates that
    other parts of the compiler also need to know to consider it dependent.

    So, this patch changes complex_alias_template_p to no longer consider
    template parameters used when their only use appears in a pack expansion,
    unless they are the parameter packs being expanded.

    To do that I also needed to change it to use cp_walk_tree instead of
    for_each_template_parm.  It occurs to me that find_template_parameters
    should probably also use cp_walk_tree, but I'm not messing with that now.

            PR c++/105003
            PR c++/104008
            PR c++/102869

    gcc/cp/ChangeLog:

            * pt.c (complex_alias_template_r): walk_tree callback,  replacing
            uses_all_template_parms_r, complex_pack_expansion_r.
            (complex_alias_template_p): Adjust.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/variadic-alias6.C: New test.
            * g++.dg/cpp0x/variadic-alias7.C: New test.

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

* [Bug c++/104008] [11 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf
  2022-01-13 14:20 [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
                   ` (16 preceding siblings ...)
  2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 20:24 ` jason at gcc dot gnu.org
  17 siblings, 0 replies; 19+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-12 20:24 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #16 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11.3/12.

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

end of thread, other threads:[~2022-04-12 20:24 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-13 14:20 [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
2022-01-13 14:55 ` [Bug c++/104008] [11/12 Regression] " jakub at gcc dot gnu.org
2022-01-13 17:28 ` redi at gcc dot gnu.org
2022-02-01 15:59 ` marxin at gcc dot gnu.org
2022-02-05 12:28 ` ahornby at fb dot com
2022-02-05 12:32 ` ahornby at fb dot com
2022-02-05 12:33 ` ahornby at fb dot com
2022-02-14 17:39 ` alex_700_95 at mail dot ru
2022-02-22 10:03 ` [Bug c++/104008] [11/12 Regression] New g++ folly compile error since r11-7931-ga2531859bf5bf6cf marxin at gcc dot gnu.org
2022-03-11 22:49 ` mpolacek at gcc dot gnu.org
2022-03-14 23:53 ` mpolacek at gcc dot gnu.org
2022-03-18 16:50 ` cvs-commit at gcc dot gnu.org
2022-03-18 16:51 ` [Bug c++/104008] [11 " mpolacek at gcc dot gnu.org
2022-03-18 18:58 ` ppalka at gcc dot gnu.org
2022-03-18 19:40 ` mpolacek at gcc dot gnu.org
2022-03-21 19:40 ` mpolacek at gcc dot gnu.org
2022-03-28 15:04 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:24 ` jason at gcc dot gnu.org

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).