public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type
@ 2022-04-06 13:01 oss.abde.sassi at gmail dot com
  2022-04-06 13:32 ` [Bug libstdc++/105178] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: oss.abde.sassi at gmail dot com @ 2022-04-06 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105178
           Summary: g++ incorrectly reports invalid use of incomplete type
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: oss.abde.sassi at gmail dot com
  Target Milestone: ---

Created attachment 52761
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52761&action=edit
self-contained small example to reproduce the error

g++ 11.20.1 incorrectly reports an invalid use of incomplete type when
compiling the attached code in main.cpp.

Note that changing the `TransitionTo` class constructor to any of the following
forms will make the compiler compile the code with no error:


// These will not produce an error:

TransitionTo() : data_{} {
}

TransitionTo(int number = 0, std::any data = {}) : data_{std::move(data)} {
}

TransitionTo(int number, std::any data = {}) : data_{std::move(data)} {
}

Command used:
-------------

gcc -v -save-temps -std=c++17 -o test-incomplete-type main.cpp >
cmdline-output.txt 2>&1

Output from command
-------------------

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin
--enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-11.2.1-20220127/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-gnu-indirect-function --enable-cet --with-tune=generic
--with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-o' 'test-incomplete-type'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'test-incomplete-type-'
 /usr/libexec/gcc/x86_64-redhat-linux/11/cc1plus -E -quiet -v -D_GNU_SOURCE
main.cpp -mtune=generic -march=x86-64 -std=c++17 -fpch-preprocess -o
test-incomplete-type-main.ii
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/11/include-fixed"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/11/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11

/usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/x86_64-redhat-linux
 /usr/lib/gcc/x86_64-redhat-linux/11/../../../../include/c++/11/backward
 /usr/lib/gcc/x86_64-redhat-linux/11/include
 /usr/local/include
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++17' '-o' 'test-incomplete-type'
'-mtune=generic' '-march=x86-64' '-dumpdir' 'test-incomplete-type-'
 /usr/libexec/gcc/x86_64-redhat-linux/11/cc1plus -fpreprocessed
test-incomplete-type-main.ii -quiet -dumpdir test-incomplete-type- -dumpbase
main.cpp -dumpbase-ext .cpp -mtune=generic -march=x86-64 -std=c++17 -version -o
test-incomplete-type-main.s
GNU C++17 (GCC) version 11.2.1 20220127 (Red Hat 11.2.1-9)
(x86_64-redhat-linux)
        compiled by GNU C version 11.2.1 20220127 (Red Hat 11.2.1-9), GMP
version 6.2.0, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++17 (GCC) version 11.2.1 20220127 (Red Hat 11.2.1-9)
(x86_64-redhat-linux)
        compiled by GNU C version 11.2.1 20220127 (Red Hat 11.2.1-9), GMP
version 6.2.0, MPFR version 4.1.0-p13, MPC version 1.2.1, isl version
isl-0.18-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: e80ddce1451d1b9471a6adee59f3d39d
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/tuple:38,
                 from main.cpp:3:
/usr/include/c++/11/type_traits: In instantiation of ‘struct
std::__and_<std::__not_<std::integral_constant<bool, false> >,
std::is_copy_constructible<TransitionTo<SecondState> > >’:
/usr/include/c++/11/type_traits:2215:11:   required by substitution of
‘template<class ... _Cond> using _Require = std::__enable_if_t<std::__and_<
<template-parameter-1-1> >::value> [with _Cond =
{std::__not_<std::integral_constant<bool, false> >,
std::is_copy_constructible<TransitionTo<SecondState> >}]’
/usr/include/c++/11/any:187:8:   required by substitution of ‘template<class
_Tp, class _VTp, class _Mgr, class> std::any::any(_Tp&&) [with _Tp = const
TransitionTo<SecondState>&; _VTp = TransitionTo<SecondState>; _Mgr =
std::any::_Manager_external<TransitionTo<SecondState> >;
<template-parameter-1-4> = <missing>]’
/usr/include/c++/11/type_traits:946:30:   required from ‘struct
std::__is_constructible_impl<TransitionTo<SecondState>, const
TransitionTo<SecondState>&>’
/usr/include/c++/11/type_traits:977:12:   required from ‘struct
std::__is_copy_constructible_impl<TransitionTo<SecondState>, true>’
/usr/include/c++/11/type_traits:984:12:   required from ‘struct
std::is_copy_constructible<TransitionTo<SecondState> >’
/usr/include/c++/11/type_traits:3179:33:   required from ‘constexpr const bool
std::is_copy_constructible_v<TransitionTo<SecondState> >’
/usr/include/c++/11/variant:288:5:   required from ‘constexpr const bool
std::__detail::__variant::_Traits<TransitionTo<SecondState>,
DoNothing>::_S_copy_ctor’
/usr/include/c++/11/variant:1317:11:   required from ‘class
std::variant<TransitionTo<SecondState>, DoNothing>’
main.cpp:35:28:   required from ‘struct OneOf<TransitionTo<SecondState>,
DoNothing>’
main.cpp:71:8:   required from ‘struct Maybe<TransitionTo<SecondState> >’
main.cpp:103:43:   required from here
/usr/include/c++/11/type_traits:152:12: error: invalid use of incomplete type
‘std::conditional<true, std::is_copy_constructible<TransitionTo<SecondState> >,
std::__not_<std::integral_constant<bool, false> > >::type’ {aka ‘struct
std::is_copy_constructible<TransitionTo<SecondState> >’}
  152 |     struct __and_<_B1, _B2>
      |            ^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/move.h:57,
                 from /usr/include/c++/11/bits/stl_pair.h:59,
                 from /usr/include/c++/11/utility:70,
                 from /usr/include/c++/11/tuple:38,
                 from main.cpp:3:
/usr/include/c++/11/type_traits:984:12: note: declaration of
‘std::conditional<true, std::is_copy_constructible<TransitionTo<SecondState> >,
std::__not_<std::integral_constant<bool, false> > >::type’ {aka ‘struct
std::is_copy_constructible<TransitionTo<SecondState> >’}
  984 |     struct is_copy_constructible
      |            ^~~~~~~~~~~~~~~~~~~~~

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

* [Bug libstdc++/105178] g++ incorrectly reports invalid use of incomplete type
  2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
@ 2022-04-06 13:32 ` rguenth at gcc dot gnu.org
  2022-04-06 13:43 ` [Bug libstdc++/105178] [11 Regression] " ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-06 13:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c++                         |libstdc++

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Sounds more like a library issue to me

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

* [Bug libstdc++/105178] [11 Regression] g++ incorrectly reports invalid use of incomplete type
  2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
  2022-04-06 13:32 ` [Bug libstdc++/105178] " rguenth at gcc dot gnu.org
@ 2022-04-06 13:43 ` ppalka at gcc dot gnu.org
  2022-04-21  7:51 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-04-06 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.3
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |rejects-valid
                 CC|                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2022-04-06
     Ever confirmed|0                           |1
            Summary|g++ incorrectly reports     |[11 Regression] g++
                   |invalid use of incomplete   |incorrectly reports invalid
                   |type                        |use of incomplete type
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=104242

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed, trunk and 11.2.0 accept the testcase. 

This is likely caused by r11-9303-g853b9d54365372 and the same bug as PR104242
except reported against 11 instead of trunk.  I can confirm that backporting
r12-7708-g7a42b1fa1a090e to the 11 branch fixes the testcase there.

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

* [Bug libstdc++/105178] [11 Regression] g++ incorrectly reports invalid use of incomplete type
  2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
  2022-04-06 13:32 ` [Bug libstdc++/105178] " rguenth at gcc dot gnu.org
  2022-04-06 13:43 ` [Bug libstdc++/105178] [11 Regression] " ppalka at gcc dot gnu.org
@ 2022-04-21  7:51 ` rguenth at gcc dot gnu.org
  2023-05-29 10:06 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-04-21  7:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 11.3 is being released, retargeting bugs to GCC 11.4.

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

* [Bug libstdc++/105178] [11 Regression] g++ incorrectly reports invalid use of incomplete type
  2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
                   ` (2 preceding siblings ...)
  2022-04-21  7:51 ` rguenth at gcc dot gnu.org
@ 2023-05-29 10:06 ` jakub at gcc dot gnu.org
  2023-06-23 11:40 ` redi at gcc dot gnu.org
  2023-06-23 12:57 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2023-05-29 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 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] 7+ messages in thread

* [Bug libstdc++/105178] [11 Regression] g++ incorrectly reports invalid use of incomplete type
  2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
                   ` (3 preceding siblings ...)
  2023-05-29 10:06 ` jakub at gcc dot gnu.org
@ 2023-06-23 11:40 ` redi at gcc dot gnu.org
  2023-06-23 12:57 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-23 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |11.3.0
      Known to work|                            |11.2.0, 12.1.0
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|NEW                         |ASSIGNED

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

* [Bug libstdc++/105178] [11 Regression] g++ incorrectly reports invalid use of incomplete type
  2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
                   ` (4 preceding siblings ...)
  2023-06-23 11:40 ` redi at gcc dot gnu.org
@ 2023-06-23 12:57 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2023-06-23 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

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

--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Patrick Palka from comment #2)
> Confirmed, trunk and 11.2.0 accept the testcase. 
> 
> This is likely caused by r11-9303-g853b9d54365372 and the same bug as
> PR104242 except reported against 11 instead of trunk.  I can confirm that
> backporting r12-7708-g7a42b1fa1a090e to the 11 branch fixes the testcase
> there.

Fixed for 11.5 with that backport.

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

end of thread, other threads:[~2023-06-23 12:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 13:01 [Bug c++/105178] New: g++ incorrectly reports invalid use of incomplete type oss.abde.sassi at gmail dot com
2022-04-06 13:32 ` [Bug libstdc++/105178] " rguenth at gcc dot gnu.org
2022-04-06 13:43 ` [Bug libstdc++/105178] [11 Regression] " ppalka at gcc dot gnu.org
2022-04-21  7:51 ` rguenth at gcc dot gnu.org
2023-05-29 10:06 ` jakub at gcc dot gnu.org
2023-06-23 11:40 ` redi at gcc dot gnu.org
2023-06-23 12:57 ` redi 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).