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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Created attachment 44642
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44642&action=edit
creduce output

Here's the result of many hours of creduction with this interestingness test:

#!/bin/bash
~/src/llvm/latest/bin/clang++ -std=c++17 petri.cc -c -w || exit 1
LANG=C g++ -std=c++17  petri.cc -c -w 2>out && exit 1
awk "/ error: invalid application of 'sizeof' to incomplete type
'boost::serialization::U'/ { found=1 ; --errors } / error: / { ++errors } END {
exit found ? errors : 99 }" out

It compiles OK with clang but with g++ -std=c++17 -w the error is:

petri-net.cc: In instantiation of 'struct a::e<boost::serialization::U>':
petri-net.cc:44:50:   required from 'class a::k<a::g<boost::serialization::U,
0, int> >'
petri-net.cc:49:47:   required from 'class a::g<boost::serialization::U, 0,
int>'
petri-net.cc:103:7:   required from 'static void boost::serialization::bh<au,
d>::bi(au) [with au = boost::cl; d = a::aa<a::g<int>, a::g<a::g<int>, 0, int>
>]'
petri-net.cc:109:3:   required from 'void boost::serialization::bk(au, d, int)
[with au = boost::cl; d = a::aa<a::g<int>, a::g<a::g<int>, 0, int> >]'
petri-net.cc:148:5:   [ skipping 32 instantiation contexts, use
-ftemplate-backtrace-limit=0 to disable ]
petri-net.cc:177:8:   required from 'static void boost::cj<au>::ck::bi(au, d)
[with d = a::g<int>; au = boost::cl]'
petri-net.cc:182:11:   required from 'static void boost::cj<au>::bi(au, d)
[with d = a::g<int>; au = boost::cl]'
petri-net.cc:188:9:   required from 'void boost::bj(au, d) [with au =
boost::cl; d = a::g<int>]'
petri-net.cc:201:7:   required from 'void boost::co::cn(d) [with d =
a::g<int>]'
petri-net.cc:208:5:   required from 'void
boost::cp::cn(boost::serialization::bd<d>) [with d = a::g<int>]'
petri-net.cc:195:46:   required from 'boost::cl& boost::interface_iarchive<
<template-parameter-1-1> >::operator>>(d) [with d =
boost::serialization::bd<a::g<int> >; <template-parameter-1-1> = int]'
petri-net.cc:225:40:   required from here
petri-net.cc:37:15: error: invalid application of 'sizeof' to incomplete type
'boost::serialization::U'
37 |   typename b< sizeof(d) >::type NonInteger;
   |               ^~~~~~~~~


Bizarrely, it compiles OK if __attribute__((__used__)) is removed on line 167.

Reply via email to