<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 - Identical deduction guides not ignored in c++2a global module fragment"
href="https://bugs.llvm.org/show_bug.cgi?id=42639">42639</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Identical deduction guides not ignored in c++2a global module fragment
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++2a
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>redbeard0531@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>iface.cpp:
module;
#include <string>
export module iface;
export std::string func() { return "hello"; }
consumer.cpp:
module;
#include <string>
export module consumer;
import iface;
auto call() { return func(); }
clang++ -std=c++2a -x c++-module iface.cpp --precompile -o iface.pcm
-stdlib=libc++
clang++ -std=c++2a -x c++ consumer.cpp -c -o consumer.o
-fmodule-file=iface.pcm -stdlib=libc++
echo <<OUTPUT
In file included from consumer.cpp:2:
In file included from /usr/include/c++/v1/string:505:
In file included from /usr/include/c++/v1/string_view:176:
In file included from /usr/include/c++/v1/__string:57:
In file included from /usr/include/c++/v1/algorithm:643:
/usr/include/c++/v1/utility:574:1: error: redeclaration of deduction guide
pair(_T1, _T2) -> pair<_T1, _T2>;
^
/usr/include/c++/v1/utility:574:1: note: previous declaration is here
pair(_T1, _T2) -> pair<_T1, _T2>;
^
In file included from consumer.cpp:2:
In file included from /usr/include/c++/v1/string:505:
In file included from /usr/include/c++/v1/string_view:176:
In file included from /usr/include/c++/v1/__string:57:
In file included from /usr/include/c++/v1/algorithm:644:
In file included from /usr/include/c++/v1/memory:663:
/usr/include/c++/v1/tuple:933:1: error: redeclaration of deduction guide
tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) ->
tuple<_Args...>;
^
/usr/include/c++/v1/tuple:933:1: note: previous declaration is here
tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) ->
tuple<_Args...>;
^
In file included from consumer.cpp:2:
In file included from /usr/include/c++/v1/string:505:
In file included from /usr/include/c++/v1/string_view:176:
In file included from /usr/include/c++/v1/__string:57:
In file included from /usr/include/c++/v1/algorithm:644:
In file included from /usr/include/c++/v1/memory:663:
/usr/include/c++/v1/tuple:935:1: error: redeclaration of deduction guide
tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>;
^
/usr/include/c++/v1/tuple:935:1: note: previous declaration is here
tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>;
^
In file included from consumer.cpp:2:
/usr/include/c++/v1/string:1665:1: error: redeclaration of deduction guide
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
^
/usr/include/c++/v1/string:1665:1: note: previous declaration is here
basic_string(_InputIterator, _InputIterator, _Allocator = _Allocator())
^
In file included from consumer.cpp:2:
/usr/include/c++/v1/string:1673:10: error: redeclaration of deduction guide
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& =
_Allocator())
^
/usr/include/c++/v1/string:1673:10: note: previous declaration is here
explicit basic_string(basic_string_view<_CharT, _Traits>, const _Allocator& =
_Allocator())
^
In file included from consumer.cpp:2:
/usr/include/c++/v1/string:1682:1: error: redeclaration of deduction guide
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& =
_Allocator())
^
/usr/include/c++/v1/string:1682:1: note: previous declaration is here
basic_string(basic_string_view<_CharT, _Traits>, _Sz, _Sz, const _Allocator& =
_Allocator())
^
6 errors generated.
I've worked around this by now by disabling the following branch:
<a href="https://github.com/llvm/llvm-project/blob/85b9651edd53d7bfb8d3076a79992450a787ec6d/clang/lib/Sema/SemaDeclCXX.cpp#L665">https://github.com/llvm/llvm-project/blob/85b9651edd53d7bfb8d3076a79992450a787ec6d/clang/lib/Sema/SemaDeclCXX.cpp#L665</a>
(not a real solution, but with that branch disabled I am able to actually test
c++2a modules)</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>