Possible gcc 15 modules regression w/ TU-local entity in constexpr function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I ran into the following error while attempting to compile the following
simple case in gcc 15.1.0. gcc 14 and clang 20 compile it without any
problems. Is this a regression or is this behavior expected?


root[18:56:11] [/workspace] $ cat a.h
constexpr int flag = 0;
constexpr bool check() {
        return flag == 0;
}

root[18:57:41] [/workspace] $ cat a.cc
module;
#include "a.h"
export module M;
export using ::check;

root[18:57:54] [/workspace] $ gcc-14 -fmodules-ts -c a.cc
# it compiles fine

root[18:57:57] [/workspace] $ gcc-15 -fmodules-ts -c a.cc
In file included from a.cc:2:
a.h:2:16: error: 'constexpr bool check()' exposes TU-local entity 'flag'
    2 | constexpr bool check() {
      |                ^~~~~
a.h:1:15: note: 'flag' declared with internal linkage
    1 | constexpr int flag = 0;
      |               ^~~~

root[18:58:00] [/workspace] $ gcc-15 --version
gcc-15 (Debian 15.1.0-1) 15.1.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux