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

* [Bug c++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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 ` pinskia at gcc dot gnu.org
  2023-03-08 17:41 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-08 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection,
                   |                            |rejects-valid
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2023-03-08
   Target Milestone|---                         |11.4
     Ever confirmed|0                           |1
      Known to fail|                            |11.1.0
      Known to work|                            |10.4.0

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

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

* [Bug c++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-08 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>* Don't use the second alias level for d, i.e. https://godbolt.org/z/KaWq9Pfq8

Using a typedef instead of alias still fails.
That is:
```
template <class T> using DataAlias = int;
template <class T> struct MyUniquePtr {};

template <class T> struct Test {
    typedef DataAlias<T> Data;
    MyUniquePtr<Data[1]> d;
};
Test<int> test;
```
Still fails.

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

* [Bug c++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-03-09 10:12 UTC (permalink / raw)
  To: gcc-bugs

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

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++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (2 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-03-09 17:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Started with r11-5825-gffb268ffcf9f21

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

* [Bug c++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (3 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-09 22:42 UTC (permalink / raw)
  To: gcc-bugs

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

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
                 CC|                            |jason at gcc dot gnu.org

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

* [Bug c++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (4 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-14 20:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> ---
The problem is that r11-5825 assumes that if a type is dependent, its
TYPE_MAIN_VARIANT and TYPE_CANONICAL are also dependent, which is not
universally true: DataAlias<T> is dependent, so that any errors from
substituting into the template-id are caught; but its TYPE_MAIN_VARIANT and
TYPE_CANONICAL are int, which is not.

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

* [Bug c++/109065] [11/12/13 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (5 preceding siblings ...)
  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
  7 siblings, 0 replies; 9+ messages in thread
From: jason at gcc dot gnu.org @ 2023-03-14 20:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> ---
Created attachment 54665
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54665&action=edit
first try

This fixes the PR, but breaks the modules tests that the earlier patch fixed. 
I guess we need a different fix for the modules issue.

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

* [Bug c++/109065] [11/12/13/14 Regression] Type alias combination erroneously fails with "incomplete type"
  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
                   ` (6 preceding siblings ...)
  2023-03-14 20:12 ` jason at gcc dot gnu.org
@ 2023-05-29 10:08 ` jakub at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|11.4                        |11.5

--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 11.4 is being released, retargeting bugs to GCC 11.5.

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