Control: tag -1 pending

Hi Olaf, hi AspectC++ developers,

While testing AspectC++ with upcoming GCC 16, which now defaults to C++20,
it turned out that the compiler no longer builds cleanly under C++20.

The initial issue in Puma/src/scanner/CLexer.h (ambiguous operator== in C++20)
is already resolved in the latest SVN trunk (AspectC++-Project r8 / AspectC++
r1813), since Puma has been retired in favor of ACBase and ACModel.

However, running the test suite under C++20 triggered another compilation
failure in the DataFlowAnalysis test:

  main.cc:298:50: error: expected '>'
    298 | if (&increment_decrement_op < &global_pointer) {
        | ^

In C++20 (specifically P0846R0 / [temp.names] p2), an unqualified function name
immediately preceding '<' in an expression is parsed as initiating a template
argument list (<...>). Because increment_decrement_op is a function name,
both Clang and GCC parse the '<' as an opening angle bracket for a template
rather than a less-than comparison, resulting in a syntax error.

Wrapping the function pointer comparison in parentheses resolves the ambiguity
and restores clean compilation under C++20:

    if ((&increment_decrement_op) < (&global_pointer)) {

I have packaged SVN snapshot 2.5+svn20261003 for Debian, dropped the obsolete
Puma packages, and included this fix.

The patch file is directly available on Salsa at:
https://salsa.debian.org/debian/aspectc/-/raw/svn-snapshot-gcc16/debian/patches/cxx20-test-dataflowanalysis.patch

The full merge request on Salsa is here:
https://salsa.debian.org/debian/aspectc/-/merge_requests/2

Attached is the patch for DataFlowAnalysis against SVN r1834 for your review
and inclusion in the upstream repository.

Best regards,
Reinhard
Description: Disambiguate function pointer comparison in DataFlowAnalysis test under C++20
 Under C++20 rules (P0846R0), an unqualified function name directly preceding
 '<' is parsed as a template name initiating a template argument list.
 Wrapping the comparison operands in parentheses disambiguates the expression
 and prevents syntax errors when the host compiler defaults to C++20 (e.g. GCC 16).
Author: Reinhard Tartler <[email protected]>
Forwarded: no
Last-Update: 2026-10-03
--- a/AspectC++/tests/DataFlowAnalysis/main.cc
+++ b/AspectC++/tests/DataFlowAnalysis/main.cc
@@ -295,7 +295,7 @@
 
   for(int i=0; i<10; ++i) {
     ptr = 0;
-    if (&increment_decrement_op < &global_pointer) {
+    if ((&increment_decrement_op) < (&global_pointer)) {
       ptr = &foo1;
       ptr->f(); // ID: 2
     }

Reply via email to