public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109065] New: [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
@ 2023-03-08 13:17 marcel.jacobse at ewetel dot net
  2023-03-08 17:37 ` [Bug c++/109065] " pinskia at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marcel.jacobse at ewetel dot net @ 2023-03-08 13:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

end of thread, other threads:[~2023-05-29 10:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 13:17 [Bug c++/109065] New: [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type" marcel.jacobse at ewetel dot net
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

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