Skip to content

Commit 5a0d77f

Browse files
committed
Improved the GCC 10.x bug note
1 parent c31320d commit 5a0d77f

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

source/cppfront.cpp

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4733,18 +4733,26 @@ class cppfront
47334733

47344734
printer.preempt_position_push( n.equal_sign );
47354735

4736-
// *** NOTE: This branch to emit the requires-clause should maybe be
4737-
// moved to location (A) above, so that it's also emitted
4738-
// on the function declaration. But doing that triggers a
4739-
// bug in GCC 10.x (that was fixed in 11.x), and 10.x is
4740-
// my main test compiler and works for everything else,
4741-
// and moving it up there would break 'forward' parameters
4742-
// with concrete types on GCC 10.x.
4743-
// So I'm not yet moving this code up to the declaration,
4744-
// given that so far things appear to be working well enough
4745-
// with the requires-clause on the function definition only...
4746-
// Handle requires clause - an explicit one plus any generated
4747-
// from processing the parameters
4736+
// *** NOTE =====================================================
4737+
//
4738+
// This branch to emit the requires-clause should maybe be
4739+
// moved to location (A) above, so that it's also emitted
4740+
// on the function declaration. But moving it to (A) triggers
4741+
// a bug in GCC 10.x (that was fixed in 11.x), where it would
4742+
// break using a 'forward' parameter of a concrete type and
4743+
// also explicitly user-written requires-clauses that do
4744+
// similar decltype tests.
4745+
//
4746+
// I don't want to neednessly break compatibility with a
4747+
// decently conforming C++20 compiler that works well for
4748+
// everything else that Cpp2 needs from C++20. If the
4749+
// 'requires' down here doesn't cause a problem, I'll keep
4750+
// it here for now... if we do encounter a reason it needs to
4751+
// also be on the declaration, move this code to (A).
4752+
//
4753+
// Handle requires clause - an explicit one the user wrote,
4754+
// and/or any conditions we generated while processing the
4755+
// parameters (i.e., forwarding a concrete type)
47484756
if (
47494757
n.requires_clause_expression
47504758
|| !function_requires_conditions.empty()
@@ -4772,6 +4780,7 @@ class cppfront
47724780
function_requires_conditions = {};
47734781
printer.ignore_alignment( false );
47744782
}
4783+
// *** END NOTE =================================================
47754784

47764785
emit(
47774786
*n.initializer,

0 commit comments

Comments
 (0)