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 instead of iosfwd makes no difference
#include
template
concept OstreamInsertable =
requires(std::ostream , 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
friend void operator<<(CSVTabIns , Type const );
// when omitted: results in bugreport1 (2)
friend CSVTabIns <<(CSVTabIns , FMT const );
friend void operator<<(CSVTabIns , FMT::FMTHline);
};
// when defined here: precompilation error (3)
template
inline void operator<<(CSVTabIns &, Type const )
{}
inline void operator<<(CSVTabIns , 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
//inline void operator<<(CSVTabIns &, Type const )
//{}
#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 '
the plain template header
'template '
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 requires
OstreamOstreamInsertable void operator<<(CSVTabIns&&, const Type&) [with
Type = FMT]’:
csvtabins:11:13: required by substitution of ‘template requires
OstreamOstreamInsertable void operator<<(CSVTabIns&, const Type&) [with
Type = FMT]’
csvtabins:45:22: required from here
csvtabins:8:9: required for the satisfaction of
‘OstreamOstreamInsertable’ [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 , 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
inline void operator<<(CSVTabIns &, Type const )
{}
template definition. When