Skip to content

Instantly share code, notes, and snippets.

@RedBeard0531
Last active Jul 16, 2019
Embed
What would you like to do?
module;
#include <string>
export module consumer;
import iface;
auto call() { return func(); }
module;
#include <string>
export module iface;
export std::string func() { return "hello"; }
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.
OUTPUT
clang++ -std=c++2a -x c++-module iface.cpp --precompile -o iface.pcm -stdlib=libc++ -fmodules
clang++ -std=c++2a -x c++ consumer.cpp -c -o consumer.o -fmodule-file=iface.pcm -stdlib=libc++ -fmodules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment