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

            Bug ID: 122395
           Summary: Wchanges-meaning false error ?
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

The following C++ code is accepted by clang++:

struct Expr
{
        int a;
        char * b;
};

  struct StmtInfo {
    const Expr *V;
    const Expr *X;
    const Expr *Expr;
    // TODO: OpenACC: We should expand this as we're implementing the other
    // atomic construct kinds.
  };

foundBugs $ clang++ -c -O2 -Wall bug1130.cc
foundBugs $

but g++ rejects it:

foundBugs $ ~/gcc/results/bin/g++ -c -O2 -Wall bug1130.cc
bug1130.cc:11:17: error: declaration of ‘const Expr* StmtInfo::Expr’ changes
meaning of ‘Expr’ [-Wchanges-meaning]
   11 |     const Expr *Expr;
      |                 ^~~~
bug1130.cc:11:11: note: used here to mean ‘struct Expr’
   11 |     const Expr *Expr;
      |           ^~~~
bug1130.cc:2:8: note: declared here
    2 | struct Expr
      |        ^~~~
foundBugs $ 

foundBugs $ ~/gcc/results/bin/g++ -v
Using built-in specs.
COLLECT_GCC=/home/dcb42/gcc/results/bin/g++
COLLECT_LTO_WRAPPER=/home/dcb42/gcc/results.20251022.asan.ubsan/libexec/gcc/x86_64-pc-linux-gnu/16.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../trunk/configure
--prefix=/home/dcb42/gcc/results.20251022.asan.ubsan --disable-multilib
--disable-bootstrap --with-build-config='bootstrap-asan bootstrap-ubsan'
--with-pkgversion=6c01778628d93c51 --with-isl
--enable-checking=df,extra,fold,rtl,yes --disable-doc
--enable-languages=c,c++,fortran
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 16.0.0 20251022 (experimental) (6c01778628d93c51) 
foundBugs $

This is from clang++ source code, so it is preventing
building clang and clang++.

Reply via email to