<html>
<head>
<base href="https://bugs.llvm.org/">
</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 - After r336132, <string> can't be compiled by gcc in < c++11 mode"
href="https://bugs.llvm.org/show_bug.cgi?id=38964">38964</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>After r336132, <string> can't be compiled by gcc in < c++11 mode
</td>
</tr>
<tr>
<th>Product</th>
<td>libc++
</td>
</tr>
<tr>
<th>Version</th>
<td>7.0
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Because <a href="https://reviews.llvm.org/rL336132">https://reviews.llvm.org/rL336132</a> introduces a few function templates
with default template arguments, gcc cannot compile <string> anymore, when
targeting c++03 or earlier:
$ echo "#include <string>" | g++ -std=c++03 -nostdinc++ -isystem
/usr/include/c++/v1 -x c++ -c - -o -
In file included from <stdin>:1:
/usr/include/c++/v1/string:812:35: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
basic_string(const _CharT* __s) {
^
/usr/include/c++/v1/string:822:62: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
basic_string(const _CharT* __s, const _Allocator& __a);
^
/usr/include/c++/v1/string:833:70: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
basic_string(size_type __n, _CharT __c, const _Allocator& __a);
^
/usr/include/c++/v1/string:844:75: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
const allocator_type& __a = allocator_type());
^
/usr/include/c++/v1/string:848:45: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
explicit basic_string(const _Tp& __t);
^
/usr/include/c++/v1/string:852:72: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
explicit basic_string(const _Tp& __t, const allocator_type& __a);
^
/usr/include/c++/v1/string:875:43: error: default template arguments may not be
used in function templates without -std=c++11 or -std=gnu++11
basic_string& operator=(const _Tp& __t)
^
Apparently gcc in c++03 mode does accept class templates with default
arguments, but not function templates.
<a href="https://reviews.llvm.org/D48616">https://reviews.llvm.org/D48616</a> already stated "I may have stepped on a bug fix
for old versions of gcc in C++03 mode - Eric? [ was introduced in r292830 ]",
and indeed it looks like this has happened.</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>