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

            Bug ID: 124470
           Summary: In C++ modules program, can't iterate with
                    std::basic_string<char32_t>::const_iterator as no
                    match for != operator
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sebj_coder3 at pm dot me
  Target Milestone: ---

Another build error for my C++ modules project. This is as far as g++ 15.2.1
gets (compiled from branch releases/gcc-15). I think the code is ok, so I would
expect this to compile.

To reproduce:

Install prerequisites. On Ubuntu/Debian it's these:

 sudo apt install build-essential git ninja-build \
                  librapidxml-dev freeglut3-dev libglu1-mesa-dev \
                  libxmu-dev libxi-dev libglfw3-dev libfreetype-dev

PLUS g++ compiled from releases/gcc15 and cmake at least version 3.28.5.

clone mathplot recursively (it has two submodules):

 git clone --recurse-submodules [email protected]:sebsjames/mathplot

switch to the dev/modules_gccbz4 branch

 cd mathplot
 git checkout dev/modules_gccbz4
 git submodule update

Build using cmake:

 mkdir bgcc
 cd bgcc
 CC=/path/to/gcc CXX=/path/to/g++ cmake .. -GNinja
 ninja helloworld

Error output:

[22:13:56 bgcc15] ninja helloworld
[9/10] Building CXX object examples/CMakeFiles/helloworld.dir/helloworld.cpp.o
FAILED: examples/CMakeFiles/helloworld.dir/helloworld.cpp.o 
/opt/gcc15/bin/g++  -I/home/seb/src/mathplot -I/home/seb/src/mathplot/maths
-I/home/seb/src/mathplot/json/include -isystem /usr/include/freetype2 -g -Wall
-Wextra -Wpedantic -pedantic-errors -Werror -Wfatal-errors -Wno-psabi -O3
-fconstexpr-ops-limit=5000000000 -DMPLOT_HAVE_STD_FORMAT -fopenmp
-DMPLOT_FONTS_DIR="\"/home/seb/src/mathplot/fonts\""  -std=c++20 -MD -MT
examples/CMakeFiles/helloworld.dir/helloworld.cpp.o -MF
examples/CMakeFiles/helloworld.dir/helloworld.cpp.o.d -fmodules-ts
-fmodule-mapper=examples/CMakeFiles/helloworld.dir/helloworld.cpp.o.modmap -MD
-fdeps-format=p1689r5 -x c++ -o
examples/CMakeFiles/helloworld.dir/helloworld.cpp.o -c
/home/seb/src/mathplot/examples/helloworld.cpp
In module mplot.visualtextmodel, imported at
/home/seb/src/mathplot/mplot/VisualOwnable.h:47,
of module mplot.visualownable, imported at
/home/seb/src/mathplot/mplot/Visual.h:36,
of module mplot.visual, imported at
/home/seb/src/mathplot/examples/helloworld.cpp:1:
/home/seb/src/mathplot/mplot/VisualTextModel.h: In instantiation of
‘mplot::[email protected]
mplot::[email protected]<glver>::getTextGeometry(const
std::string&) [with int glver = 262145; std::string =
std::__cxx11::basic_string<char>]’:
/home/seb/src/mathplot/mplot/VisualOwnable.h:562:63:   required from
‘mplot::[email protected]
mplot::[email protected]<glver>::addLabel(const std::string&,
const sm::[email protected]<float, 3>&, const mplot::[email protected]&)
[with int glver = 262145; std::string = std::__cxx11::basic_string<char>]’
  562 |                 mplot::TextGeometry tg = tmup->getTextGeometry(_text);
      |                                          ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
/home/seb/src/mathplot/examples/helloworld.cpp:7:16:   required from here
    7 |     v.addLabel ("Hello World!", {0,0,0});
      |     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
/home/seb/src/mathplot/mplot/VisualTextModel.h:131:83: error: no match for
‘operator!=’ (operand types are
‘std::__cxx11::basic_string<char32_t>::const_iterator’ and
‘std::__cxx11::basic_string<char32_t>::const_iterator’)
  131 |             for (std::basic_string<char32_t>::const_iterator c =
utxt.cbegin(); c != utxt.cend(); c++) {
      |                                                                        
        ~~^~~~~~~~~~~~~~
compilation terminated due to -Wfatal-errors.
ninja: build stopped: subcommand failed.

This code compiles in a non-modules version of this project.

Reply via email to