public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD
@ 2022-01-07 16:28 cbcode at gmail dot com
  2022-01-07 22:24 ` [Bug c++/103943] [11/12 Regression] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: cbcode at gmail dot com @ 2022-01-07 16:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103943
           Summary: ICE building qualified name inside class with variadic
                    CTAD
           Product: gcc
           Version: 11.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cbcode at gmail dot com
  Target Milestone: ---

// gcc has known problems with variadic CTAD, not sure if this is related.
// regression (was fine in v8.3.0).

template<typename R, typename...AA> struct F0 { //OK
    R(*fun_ptr)(AA...);
};
template<typename R, typename...AA> struct F1 { //OK
    R(*fun_ptr)(AA...);
    F1(R(*fun_ptr)(AA...)) : fun_ptr(fun_ptr) {}
};
template<typename R, typename...AA> struct F2 { //OK
    R(*fun_ptr)(AA...);
    using fun_ptr_t = decltype(fun_ptr);
    F2(fun_ptr_t fun_ptr) : fun_ptr(fun_ptr) {}
};
template<typename R, typename...AA> struct F3 {
    R(*fun_ptr)(AA...);
//  using fun_ptr_t = decltype(fun_ptr); //OK as in F2
    using fun_ptr_t = decltype(F3::fun_ptr); //ICE: Segmentation fault
//  using fun_ptr_t = decltype(F3<R, AA...>::fun_ptr); //ICE: Segmentation
fault
    F3(fun_ptr_t fun_ptr) : fun_ptr(fun_ptr) {}
};
template<typename R, typename...AA> struct F4 {
    static R fun_not_implemented(AA...);
//  using fun_ptr_t = decltype(&fun_not_implemented); //OK
    using fun_ptr_t = decltype(&F4::fun_not_implemented); //OK with aggregate
initialization (no ctor)
//  using fun_ptr_t = decltype(&F4<R, AA...>::fun_not_implemented); //OK with
aggregate initialization (no ctor)
    fun_ptr_t fun_ptr;
};
template<typename R, typename...AA> struct F5 { //OK
    static R fun_not_implemented(AA...);
    using fun_ptr_t = decltype(&fun_not_implemented);
    fun_ptr_t fun_ptr;
    F5(fun_ptr_t fun_ptr) : fun_ptr(fun_ptr) {}
};
template<typename R, typename...AA> struct F6 {
    static R fun_not_implemented(AA...);
//  using fun_ptr_t = decltype(&fun_not_implemented); //OK as in F5
    using fun_ptr_t = decltype(&F6::fun_not_implemented); //ICE: in
build_qualified_name, at cp/tree.c:2238
//  using fun_ptr_t = decltype(&F6<R, AA...>::fun_not_implemented); //ICE: in
build_qualified_name, at cp/tree.c:2238
    fun_ptr_t fun_ptr;
    F6(fun_ptr_t fun_ptr) : fun_ptr(fun_ptr) {}
};
template<typename R, typename...AA> F0(R(*fun_ptr)(AA...)) -> F0<R, AA...>;
template<typename R, typename...AA> F1(R(*fun_ptr)(AA...)) -> F1<R, AA...>;
template<typename R, typename...AA> F2(R(*fun_ptr)(AA...)) -> F2<R, AA...>;
template<typename R, typename...AA> F3(R(*fun_ptr)(AA...)) -> F3<R, AA...>;
template<typename R, typename...AA> F4(R(*fun_ptr)(AA...)) -> F4<R, AA...>;
template<typename R, typename...AA> F5(R(*fun_ptr)(AA...)) -> F5<R, AA...>;
template<typename R, typename...AA> F6(R(*fun_ptr)(AA...)) -> F6<R, AA...>;

int fun(int a) {
    return a + 1;
}
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
void test() {
    auto f0 = F0{&fun}; //OK
    auto f1 = F1{&fun}; //OK
    auto f2 = F2{&fun}; //OK
    auto f3 = F3{&fun}; //ICE: Segmentation fault
    auto f4 = F4{&fun}; //OK
    auto f5 = F5{&fun}; //OK
    auto f6 = F6{&fun}; //ICE: in build_qualified_name, at cp/tree.c:2238
}

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

* [Bug c++/103943] [11/12 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
@ 2022-01-07 22:24 ` pinskia at gcc dot gnu.org
  2022-01-07 22:25 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 22:24 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
      Known to fail|                            |11.1.0
            Summary|ICE building qualified name |[11/12 Regression] ICE
                   |inside class with variadic  |building qualified name
                   |CTAD                        |inside class with variadic
                   |                            |CTAD
      Known to work|                            |10.3.0
   Target Milestone|---                         |11.3

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

* [Bug c++/103943] [11/12 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
  2022-01-07 22:24 ` [Bug c++/103943] [11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-07 22:25 ` pinskia at gcc dot gnu.org
  2022-01-08 16:44 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-07 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-01-07
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/103943] [11/12 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
  2022-01-07 22:24 ` [Bug c++/103943] [11/12 Regression] " pinskia at gcc dot gnu.org
  2022-01-07 22:25 ` pinskia at gcc dot gnu.org
@ 2022-01-08 16:44 ` ppalka at gcc dot gnu.org
  2022-01-10 10:54 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-08 16:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
           Keywords|needs-bisection             |

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-2748

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

* [Bug c++/103943] [11/12 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
                   ` (2 preceding siblings ...)
  2022-01-08 16:44 ` ppalka at gcc dot gnu.org
@ 2022-01-10 10:54 ` rguenth at gcc dot gnu.org
  2022-03-27  1:46 ` jason at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-10 10:54 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug c++/103943] [11/12 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
                   ` (3 preceding siblings ...)
  2022-01-10 10:54 ` rguenth at gcc dot gnu.org
@ 2022-03-27  1:46 ` jason at gcc dot gnu.org
  2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2022-03-27  1:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/103943] [11/12 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
                   ` (4 preceding siblings ...)
  2022-03-27  1:46 ` jason at gcc dot gnu.org
@ 2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:14 ` [Bug c++/103943] [11 " cvs-commit at gcc dot gnu.org
  2022-04-12 20:25 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-03-28 13:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:8bc5cdaafa2e729f9209684dc30aa0acb72d2580

commit r12-7851-g8bc5cdaafa2e729f9209684dc30aa0acb72d2580
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Mar 26 22:05:53 2022 -0400

    c++: CTAD and member function references [PR103943]

    More quirks of rewriting member references to dependent references for
    CTAD.  A reference to a member of dependent scope is definitely dependent.
    And since r11-7044, tsubst_baselink builds a SCOPE_REF, so
    tsubst_qualified_id should just use it.

            PR c++/103943

    gcc/cp/ChangeLog:

            * pt.cc (tsubst_qualified_id): Handle getting SCOPE_REF from
            tsubst_baselink.
            (instantiation_dependent_scope_ref_p): Check dependent_scope_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/class-deduction109.C: New test.

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

* [Bug c++/103943] [11 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
                   ` (5 preceding siblings ...)
  2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
@ 2022-04-12 20:14 ` cvs-commit at gcc dot gnu.org
  2022-04-12 20:25 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ 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=103943

--- Comment #4 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:3a17a1842350e7a9a6e81931e8ad66184b33efb2

commit r11-9825-g3a17a1842350e7a9a6e81931e8ad66184b33efb2
Author: Jason Merrill <jason@redhat.com>
Date:   Sat Mar 26 22:05:53 2022 -0400

    c++: CTAD and member function references [PR103943]

    More quirks of rewriting member references to dependent references for
    CTAD.  A reference to a member of dependent scope is definitely dependent.
    And since r11-7044, tsubst_baselink builds a SCOPE_REF, so
    tsubst_qualified_id should just use it.

            PR c++/103943

    gcc/cp/ChangeLog:

            * pt.c (tsubst_qualified_id): Handle getting SCOPE_REF from
            tsubst_baselink.
            (instantiation_dependent_scope_ref_p): Check dependent_scope_p.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp1z/class-deduction109.C: New test.

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

* [Bug c++/103943] [11 Regression] ICE building qualified name inside class with variadic CTAD
  2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
                   ` (6 preceding siblings ...)
  2022-04-12 20:14 ` [Bug c++/103943] [11 " cvs-commit at gcc dot gnu.org
@ 2022-04-12 20:25 ` jason at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-12 20:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

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

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-07 16:28 [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD cbcode at gmail dot com
2022-01-07 22:24 ` [Bug c++/103943] [11/12 Regression] " pinskia at gcc dot gnu.org
2022-01-07 22:25 ` pinskia at gcc dot gnu.org
2022-01-08 16:44 ` ppalka at gcc dot gnu.org
2022-01-10 10:54 ` rguenth at gcc dot gnu.org
2022-03-27  1:46 ` jason at gcc dot gnu.org
2022-03-28 13:37 ` cvs-commit at gcc dot gnu.org
2022-04-12 20:14 ` [Bug c++/103943] [11 " cvs-commit at gcc dot gnu.org
2022-04-12 20:25 ` 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).