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

            Bug ID: 115941
           Summary: g++ compiler version 15 doesn't fails to build when
                    g++ 12 does (may be related to
                    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109247)
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vincent.lebourlot at starqube dot com
  Target Milestone: ---

Here is a minimal code that doesn't compile with gcc 15 trunk version 

```
gcc-15/bin/g++ --version
g++ (GCC) 15.0.0 20240715 (experimental)
Copyright (C) 2024 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.

```

```cpp
#include <vector>
#include <string_view>
#include <string>
#include <span>

class piece{
        public:
                std::string_view view;
                piece(const void*)=delete;
                template<size_t n>explicit piece(const
char(&s)[n])noexcept:view(s,n-1){}
        };

        class NLargeStringPiece{};

class string{
        private:
                std::array<unsigned char,16>value;
        public:
                string(const void*)=delete;
                template<size_t n>string(const char(&s)[n])noexcept:value(){}
                template<typename...Args>explicit string(const
Args&...args)requires(std::conjunction_v<std::disjunction<std::is_constructible<piece,Args>,std::is_constructible<NLargeStringPiece,Args>>...>):value(){}

        };

        int main() noexcept{
                std::vector<std::pair<string,string>>foo{{{"foo","foo"}}};
               
std::vector<std::pair<string,string>>bar{{{"bar","bar"},{"bar","bar"}}};
                return 0;
        }
```

and the error being printed: 

```
 ❯/usr/local/gcc/gcc-12.3/bin/g++
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp -o
/home/lebourlot/gcc15/StarQube/Sources/Scratch/Scratch.exe -std=c++2b -g -Wall
-fPIC -pie -static-libstdc++ -gdwarf-4 -pthread -maes -msse4.1 -isystem
/usr/local/include
 ❯/usr/local/gcc/gcc-15/bin/g++
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp -o
/home/lebourlot/gcc15/StarQube/Sources/Scratch/Scratch.exe -std=c++2b -g -Wall
-fPIC -pie -static-libstdc++ -gdwarf-4 -pthread -maes -msse4.1 -isystem
/usr/local/include
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp: In function
‘int main()’:
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp:27:87: error:
converting to ‘string’ from initializer list would use explicit constructor
‘string::string(const Args& ...) requires 
conjunction_v<std::disjunction<std::is_constructible<piece, Args>,
std::is_constructible<NLargeStringPiece, Args> >...> [with Args = {char [4],
char [4]}]’
   27 |                
std::vector<std::pair<string,string>>bar{{{"bar","bar"},{"bar","bar"}}};
      |                                                                        
              ^
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp:21:51: note:
‘string::string(const Args& ...) requires 
conjunction_v<std::disjunction<std::is_constructible<piece, Args>,
std::is_constructible<NLargeStringPiece, Args> >...> [with Args = {char [4],
char [4]}]’ declared here
   21 |                 template<typename...Args>explicit string(const
Args&...args)requires(std::conjunction_v<std::disjunction<std::is_constructible<piece,Args>,std::is_constructible<NLargeStringPiece,Args>>...>):value(){}
      |                                                   ^~~~~~
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp:27:87: error:
converting to ‘string’ from initializer list would use explicit constructor
‘string::string(const Args& ...) requires 
conjunction_v<std::disjunction<std::is_constructible<piece, Args>,
std::is_constructible<NLargeStringPiece, Args> >...> [with Args = {char [4],
char [4]}]’
   27 |                
std::vector<std::pair<string,string>>bar{{{"bar","bar"},{"bar","bar"}}};
      |                                                                        
              ^
/home/lebourlot/gcc15/StarQube/Sources/Scratch/ToolScratch.cpp:21:51: note:
‘string::string(const Args& ...) requires 
conjunction_v<std::disjunction<std::is_constructible<piece, Args>,
std::is_constructible<NLargeStringPiece, Args> >...> [with Args = {char [4],
char [4]}]’ declared here
   21 |                 template<typename...Args>explicit string(const
Args&...args)requires(std::conjunction_v<std::disjunction<std::is_constructible<piece,Args>,std::is_constructible<NLargeStringPiece,Args>>...>):value(){}
      |                                                   ^~~~~~
[1]    876699 exit 1     /usr/local/gcc/gcc-15/bin/g++  -o  -std=c++2b -g -Wall
-fPIC -pie  -gdwarf-4 
```

Reply via email to