[Bug c++/106826] New: [modules] Variable template of type trait via importable header gives wrong result
johelegp at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Sep 4 17:57:09 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106826
Bug ID: 106826
Summary: [modules] Variable template of type trait via
importable header gives wrong result
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: johelegp at gmail dot com
Target Milestone: ---
See https://godbolt.org/z/Yjrcv6sG1.
```sh
CXX=/home/johel/root/gcc/bin/g++
echo "./my.std.headers.hpp my.std.headers.gcm
my.std my.std.gcm
my.module my.module.gcm" > mm.txt
echo "#include <type_traits>" > my.std.headers.hpp
echo "export module my.std;
export import \"my.std.headers.hpp\";" > my.std.cpp
echo "export module my.module;
import my.std;
static_assert(std::is_lvalue_reference_v<int&>);
export int _;" > my.module.cpp
$CXX -std=c++23 -fmodules-ts -fmodule-mapper=mm.txt -x c++-header -c
my.std.headers.hpp
$CXX -std=c++23 -fmodules-ts -fmodule-mapper=mm.txt -c my.std.cpp
$CXX -std=c++23 -fmodules-ts -fmodule-mapper=mm.txt -c my.module.cpp
```
Output:
```
my.module.cpp:3:20: error: static assertion failed
3 | static_assert(std::is_lvalue_reference_v<int&>);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
my.module.cpp:1:8: warning: not writing module ‘my.module’ due to errors
1 | export module my.module;
| ^~~~~~
```
GCC12 passes the assertion.
More information about the Gcc-bugs
mailing list