<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Clang svn r219085 fails to compile regex program using libstdc++ in C++1y, C++14, C++1z"
   href="http://llvm.org/bugs/show_bug.cgi?id=21196">21196</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang svn r219085 fails to compile regex program using libstdc++ in C++1y, C++14, C++1z
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>remyabel@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=13163" name="attach_13163" title="The test program which uses regex">attachment 13163</a> <a href="attachment.cgi?id=13163&action=edit" title="The test program which uses regex">[details]</a></span>
The test program which uses regex

For more information, see
<a href="https://stackoverflow.com/questions/26245167/compiling-regex-program-in-clang-for-libstdc-in-c14-mode-causes-errors">https://stackoverflow.com/questions/26245167/compiling-regex-program-in-clang-for-libstdc-in-c14-mode-causes-errors</a>

The libstdc++ binary is libstdc++.so.6.0.20

The following test program works fine with the following command lines for the
attached test program (using gcc 4.9.1):

g++4.9 -std=c++11 test.cpp
g++4.9 -std=c++1y test.cpp
g++4.9 -std=c++14 test.cpp
clang++ -stdlib=libstdc++ -std=c++11 test.cpp
clang++ -stdlib=libc++ -std=c++11 test.cpp
clang++ -stdlib=libc++ -std=c++1y test.cpp
clang++ -stdlib=libc++ -std=c++14 test.cpp
clang++ -stdlib=libc++ -std=c++1z test.cpp

When using the following command lines:

clang++ -stdlib=libstdc++ -std=c++1y test.cpp
clang++ -stdlib=libstdc++ -std=c++14 test.cpp
clang++ -stdlib=libstdc++ -std=c++1y test.cpp

it fails to compile with the following errors:

    In file included from main.cpp:4:
    In file included from
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/regex:58:
    In file included from
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.h:2721:
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.tcc:632:11:
error: member function '_M_end_of_seq' not viable: 'this' argument has type
'const std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >', but function is
not marked const
          if (_M_end_of_seq() && __rhs._M_end_of_seq())
              ^~~~~~~~~~~~~
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.h:2641:24:
note: in instantiation of member function
'std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >::operator=='
requested here
          { return !(*this == __rhs); }
                           ^
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/stl_algobase.h:305:19:
note: in instantiation of member function
'std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >::operator!='
requested here
              for (; __first != __last; ++__result, ++__first)
                             ^
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/stl_algobase.h:396:36:
note: in instantiation of function template specialization
'std::__copy_move<false, false,
std::forward_iterator_tag>::__copy_m<std::regex_token_iterator<__gnu_cxx::__normal_iterator<const
char *, std::basic_string<char> >, char, std::regex_traits<char> >,
std::ostream_iterator<std::basic_string<char>, char, std::char_traits<char> >
<span class="quote">>' requested here</span >
                                  _Category>::__copy_m(__first, __last,
__result);
                                              ^
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/stl_algobase.h:432:23:
note: in instantiation of function template specialization
'std::__copy_move_a<false,
std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >,
std::ostream_iterator<std::basic_string<char>, char, std::char_traits<char> >
<span class="quote">>' requested here</span >
          return _OI(std::__copy_move_a<_IsMove>(std::__niter_base(__first),
                          ^
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/stl_algobase.h:464:20:
note: in instantiation of function template specialization
'std::__copy_move_a2<false,
std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >,
std::ostream_iterator<std::basic_string<char>, char, std::char_traits<char> >
<span class="quote">>' requested here</span >
          return (std::__copy_move_a2<__is_move_iterator<_II>::__value>
                       ^
    main.cpp:13:9: note: in instantiation of function template specialization
'std::copy<std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >,
std::ostream_iterator<std::basic_string<char>, char, std::char_traits<char> >
<span class="quote">>' requested here</span >
       std::copy( std::sregex_token_iterator(text.begin(), text.end(), ws_re,
-1),
            ^
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.h:2690:7:
note: '_M_end_of_seq' declared here
          _M_end_of_seq()
          ^
    In file included from main.cpp:4:
    In file included from
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/regex:58:
    In file included from
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.h:2721:
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.tcc:637:11:
error: member function '_M_end_of_seq' not viable: 'this' argument has type
'const std::regex_token_iterator<__gnu_cxx::__normal_iterator<const char *,
std::basic_string<char> >, char, std::regex_traits<char> >', but function is
not marked const
          if (_M_end_of_seq() || _M_suffix.matched
    a
              ^~~~~~~~~~~~~
   
/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.9.0/../../../../include/c++/4.9.0/bits/regex.h:2690:7:
note: '_M_end_of_seq' declared here
          _M_end_of_seq()</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>