Bug#1094907: g++-14: 'using' declarations may cause compiler errors when compiling modules
Package: g++-14
Version: 14.2.0-12
Severity: normal
Dear Maintainer,
* What led up to the situation?
When working on the conversion of existing projectss to projects using modules
the compiler reported an (unclear) error message when compiling a source file
defining a module.
* What exactly did you do that caused the issue?
First I prepared in /usr/include/c++/14/ filesystem.gcm and memory.gcm,
calling
g++ --std=c++26 -Wall -fmodules-ts -x c++-system-header filesystem
and
g++ --std=c++26 -Wall -fmodules-ts -x c++-system-header memory
followed by
mv gcm.cache/usr/include/c++/14/*.gcm .
so they're located in /usr/include/c++/14/ and can be imported.
Then I wrote this source file (e.g., modsupport.cc, stripped down to its bare
essentials):
---------------------------------------------
export module Support;
export import <filesystem>;
export import <memory>;
export
{
class Support
{
using Path = std::filesystem::path;
};
}
---------------------------------------------
In its directory I defined a sub-directory gcm.cache having a softlink
usr -> /usr
so the module-compiled headers are available.
* What was the outcome of this action?
When compiling modsupport.cc using
g++ --std=c++26 -Wall -fmodules-ts -c modsupport.cc
the compiler reports:
modsupport.cc: In destructor ‘virtual std::filesystem::__cxx11::path::_Codecvt<char16_t>::~_Codecvt()’:
modsupport.cc:24:35: warning: ignoring attributes applied to ‘std::auto_ptr< <template-parameter-1-1> >’ after definition [-Wattributes]
24 | using Path = std::filesystem::path;
| ^~~~
modsupport.cc:24:35: note: during load of pendings for ‘std::codecvt’
modsupport.cc: In destructor ‘virtual std::filesystem::__cxx11::path::_Codecvt<wchar_t>::~_Codecvt()’:
modsupport.cc:24:35: note: during load of pendings for ‘std::filesystem::__cxx11::path’
modsupport.cc: In destructor ‘virtual std::codecvt_utf8<wchar_t>::~codecvt_utf8()’:
modsupport.cc:24:35: note: during load of pendings for ‘std::codecvt_utf8’
modsupport.cc: At global scope:
modsupport.cc:24:35: note: during load of binding ‘std::filesystem::__cxx11::path’
which, AFAICS, isn't something I can repair.
Also: when 'export import <memory>;' isn't specified the error message doesn't
appear.
* What outcome did you expect instead?
I'd expect that the compilation would succeed without errors.
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 6.12.10-amd64 (SMP w/2 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages g++-14 depends on:
ii g++-14-x86-64-linux-gnu 14.2.0-12
ii gcc-14 14.2.0-12
ii gcc-14-base 14.2.0-12
g++-14 recommends no packages.
Versions of packages g++-14 suggests:
pn g++-14-multilib <none>
pn gcc-14-doc <none>
-- no debconf information
Reply to: