[llvm-bugs] [Bug 42639] New: Identical deduction guides not ignored in c++2a global module fragment

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jul 16 09:21:51 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42639

            Bug ID: 42639
           Summary: Identical deduction guides not ignored in c++2a global
                    module fragment
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: redbeard0531 at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

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:
https://github.com/llvm/llvm-project/blob/85b9651edd53d7bfb8d3076a79992450a787ec6d/clang/lib/Sema/SemaDeclCXX.cpp#L665
(not a real solution, but with that branch disabled I am able to actually test
c++2a modules)

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190716/eb7f029a/attachment.html>


More information about the llvm-bugs mailing list