Bug#1073932: libstdc++-14-dev: 'using' specification results in compiler error when specifying -fmodules-ts
Package: libstdc++-14-dev
Version: 14-20240330-1
Severity: normal
Tags: upstream
Dear Maintainer,
* What led up to the situation?
When specifying a 'using' declaration the compiler produces an error when the
-fmodules-ts flag is used.
* What exactly did you do (or not do) that was effective (or
ineffective)?
The following program compiles correctly when -fmodules is *not* specified,
and produces an error when -fmodules *is* specified. In the latter case: if
instead of the #include directives 'import' statements (like 'import
<vector>;' are used the same error results. But when '#include <iostream>' (or
'import <iostream>;' is omitted compilation using the -fmodules-ts flag
correctly completes.
The following source file (between ======= lines) was compiled by calling:
g++ --std=c++23 -Wall -fmodules-ts -freport-bug -c main.cc
===================================================
#include <iostream>
#include <vector>
int main()
{
using VectorInt = std::vector<int>;
VectorInt vi(3);
}
===================================================
* What was the outcome of this action?
main.cc: In function ‘int main()’:
main.cc:6:38: error: wrong number of template arguments (1, should be 2)
6 | using VectorInt = std::vector<int>;
| ^
In file included from /usr/include/c++/14/ostream:43,
from /usr/include/c++/14/iostream:41,
of module /usr/include/c++/14/iostream, imported at main.cc:1:
/usr/include/c++/14/format:2577:36: note: provided for ‘template<class, class> class std::vector’
2577 | template<typename, typename> class vector;
| ^~~~~~
main.cc:6:28: error: ‘<expression error>’ in namespace ‘std’ does not name a type
6 | using VectorInt = std::vector<int>;
| ^~~~~~~~~~~
main.cc:8:5: error: ‘VectorInt’ was not declared in this scope
8 | VectorInt vi(3);
| ^~~~~~~~~
* What outcome did you expect instead?
The same as when -fmodule-ts is not specified: errorless compilation
-- System Information:
Debian Release: trixie/sid
APT prefers testing
APT policy: (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.7.12-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages libstdc++-14-dev depends on:
ii gcc-14-base 14-20240330-1
ii libc6-dev 2.38-13
ii libgcc-14-dev 14-20240330-1
ii libstdc++6 14-20240330-1
libstdc++-14-dev recommends no packages.
Versions of packages libstdc++-14-dev suggests:
pn libstdc++-14-doc <none>
-- no debconf information
Reply to: