public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cbcode at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/103943] New: ICE building qualified name inside class with variadic CTAD
Date: Fri, 07 Jan 2022 16:28:18 +0000	[thread overview]
Message-ID: <bug-103943-4@http.gcc.gnu.org/bugzilla/> (raw)

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
}

             reply	other threads:[~2022-01-07 16:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 16:28 cbcode at gmail dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-103943-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).