--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: g++-11 internal error and fails to precompile a concept
- From: Frank Brokken <f.b.brokken@rug.nl>
- Date: Sun, 14 Mar 2021 14:35:24 +0100
- Message-id: <161572892414.3260237.2141566376356202778.reportbug@suffix.rc.rug.nl>
Package: g++-11
Version: 11-20210306-1
Severity: normal
Dear Maintainer,
* What led up to the situation?
Following the installation of g++-11 a previously precompilable header file
can't be precompiled anymore, and in some cases the compiler reports an
internal error requesting to submit a bug report.
* What exactly did you do (or not do) that was effective (or
ineffective)?
After upgrading g++ to version 11.0.1 the compiler reports a problem when
precompiling the following header file (shown between the ----------
lines). Additional information is provided below the next *-ed question.
--------------------------------------
#ifndef INCLUDED_CSVTABINS_
#define INCLUDED_CSVTABINS_
// #include <ostream> instead of iosfwd makes no difference
#include <iosfwd>
template <typename Type>
concept OstreamInsertable =
requires(std::ostream &out, Type value)
{
out << value;
};
// when using typename instead of the above concept : no error (1)
// e.g., by activating the following #define
// #define OstreamInsertable typename
struct FMT
{
enum Align
{};
typedef FMT (*FMTFun)(unsigned, unsigned);
typedef FMT (*FMTHline)(unsigned);
};
class CSVTabIns
{
template <OstreamInsertable Type>
friend void operator<<(CSVTabIns &tab, Type const &value);
// when omitted: results in bugreport1 (2)
friend CSVTabIns &operator<<(CSVTabIns &tab, FMT const &fmt);
friend void operator<<(CSVTabIns &tab, FMT::FMTHline);
};
// when defined here: precompilation error (3)
template <OstreamInsertable Type>
inline void operator<<(CSVTabIns &&tab, Type const &value)
{}
inline void operator<<(CSVTabIns &tab, FMT::FMTHline hline)
{
// when the insertion is omitted: no precompilation error
tab << (*hline)(1); // insert hline in the next column
}
// when defined here: no precompilation error (4)
//template <OstreamInsertable Type>
//inline void operator<<(CSVTabIns &&tab, Type const &value)
//{}
#endif
--------------------------------------
* What was the outcome of this action?
Points to note (see the (x) marked comment entries:
1: If the concept isn't used, but instead of using
'template <OstreamOstreamInsertable Type>'
the plain template header
'template <typename Type>'
is used compilation completes flawlessly.
Also, when using version
g++-10 (Debian 10.2.1-6) 10.2.1 20210110
no problem is reported.
With g++-11 the received error message is:
csvtabins: In substitution of ‘template<class Type> requires OstreamOstreamInsertable<Type> void operator<<(CSVTabIns&&, const Type&) [with Type = FMT]’:
csvtabins:11:13: required by substitution of ‘template<class Type> requires OstreamOstreamInsertable<Type> void operator<<(CSVTabIns&, const Type&) [with Type = FMT]’
csvtabins:45:22: required from here
csvtabins:8:9: required for the satisfaction of ‘OstreamOstreamInsertable<Type>’ [with Type = FMT]
csvtabins:9:5: in requirements with ‘std::ostream& out’, ‘Type value’ [with Type = FMT]
csvtabins:9:5: error: satisfaction of atomic constraint ‘requires(std::ostream& out, Type value) {out << value;} [with Type = Type]’ depends on itself
9 | requires(std::ostream &out, Type value)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 | {
| ~
11 | out << value;
| ~~~~~~~~~~~~~
12 | };
| ~
which, I'm afraid, doesn't help me to understand the nature of the
problem. In particular it's unclear what is meant by 'satisfaction of
atomic constraint ... depends on itself'.
2: When the friend declaration below (2) is omitted, the compiler reports
an internal error requesting to submit a bug-report.
In particular, the compiler reports:
csvtabins:11:13: internal compiler error: in get, at cp/constraint.cc:2656
11 | out << value;
...
0xc84ae6 tsubst_simple_requirement
../../src/gcc/cp/constraint.cc:1983
Please submit a full bug report,
with preprocessed source if appropriate.
To reduce the size of this bug-report: the compiler's full output can
be retrieved from 'https://www.icce.rug.nl/tmp/bugreport1'. The precompiled
header produced by the compiler when it generated bugreport1 can be retrieved
from 'https://www.icce.rug.nl/tmp/bugreport1-csvtabins.gch'.
When instead of g++-11 g++-10 (Debian 10.2.1-6) 10.2.1 20210110) is used
then no internal error emerges, but just a normal error about a missing
operator<<. E.g.:
csvtabins: In function ‘void operator<<(CSVTabIns&, FMT::FMTHline)’:
csvtabins:45:9: error: no match for ‘operator<<’ (operand types are ‘CSVTabIns’ and ‘FMT’)
45 | tab << (*hline)(1); // insert hline in the next column
| ~~~ ^~ ~~~~~~~~~~~
| | |
| CSVTabIns FMT
...
3 and 4: Whether the compilation error is encountered or not depends on the
position of the
template <OstreamInsertable Type>
inline void operator<<(CSVTabIns &&tab, Type const &value)
{}
template definition. When it's defined below (3) the error is
encountered, when it's defined below (4) compilation succeeds without
error.
* What outcome did you expect instead?
The same as with g++-10: no errors.
Also, the meaning of the displayed compilation error (satisfaction of
atomic constraint 'requires(std::ostream& out, Type value) {out << value;}
[with Type = Type]' depends on itself) is (at least to me) unclear, and
doesn't provide me with any hint about how to fix the problem.
-- System Information:
Debian Release: bullseye/sid
APT prefers testing
APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 5.10.0-3-amd64 (SMP w/4 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages g++-11 depends on:
ii gcc-11 11-20210306-1
ii gcc-11-base 11-20210306-1
ii libc6 2.31-9
ii libgmp10 2:6.2.1+dfsg-1
ii libisl23 0.23-1
ii libmpc3 1.2.0-1
ii libmpfr6 4.1.0-3
ii libstdc++-11-dev 11-20210306-1
ii libzstd1 1.4.8+dfsg-2
ii zlib1g 1:1.2.11.dfsg-2
g++-11 recommends no packages.
Versions of packages g++-11 suggests:
pn g++-11-multilib <none>
pn gcc-11-doc <none>
-- no debconf information
--- End Message ---