public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marcel.jacobse at ewetel dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/109065] New: [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
Date: Wed, 08 Mar 2023 13:17:20 +0000	[thread overview]
Message-ID: <bug-109065-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 109065
           Summary: [11/12/13 Regression] Type alias combination
                    erroneously fails with "incomplete type"
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marcel.jacobse at ewetel dot net
  Target Milestone: ---

Starting with gcc 11.1, the code

template <class T> using DataAlias = int;
template <class T> struct MyUniquePtr {};

template <class T> struct Test {
    using Data = DataAlias<T>;
    MyUniquePtr<Data[]> d;
};
Test<int> test;

fails to compile with

<source>: In instantiation of 'struct Test<int>':
<source>:8:11:   required from here
<source>:6:25: error: 'Test<T>::d' has incomplete type
    6 |     MyUniquePtr<Data[]> d;
      |                         ^
<source>:2:27: note: declaration of 'struct MyUniquePtr<int []>'
    2 | template <class T> struct MyUniquePtr {};
      |                           ^~~~~~~~~~~

See for example: https://godbolt.org/z/oq9TjqKrW
I believe this to be valid C++11 through C++20 and it seems to compile just
fine with clang, MSVC and any gcc <= 10.4 that supports C++11.

A range of minor changes make it compile again, for example:
* Make DataAlias actually use T in any way, e.g.
https://godbolt.org/z/cb9dW1E6s
* Don't use an array type for d, i.e. https://godbolt.org/z/MGKPcjEz3
* Don't use the second alias level for d, i.e. https://godbolt.org/z/KaWq9Pfq8

             reply	other threads:[~2023-03-08 13:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-08 13:17 marcel.jacobse at ewetel dot net [this message]
2023-03-08 17:37 ` [Bug c++/109065] " pinskia at gcc dot gnu.org
2023-03-08 17:41 ` pinskia at gcc dot gnu.org
2023-03-09 10:12 ` rguenth at gcc dot gnu.org
2023-03-09 17:26 ` ppalka at gcc dot gnu.org
2023-03-09 22:42 ` jason at gcc dot gnu.org
2023-03-14 20:11 ` jason at gcc dot gnu.org
2023-03-14 20:12 ` jason at gcc dot gnu.org
2023-05-29 10:08 ` [Bug c++/109065] [11/12/13/14 " jakub 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-109065-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).