1 //-----------------------------------------------------------------------------
2 // boost-libs variant/test/variant_visit_internal_linkage.cpp header file
3 // See http://www.boost.org for updates, documentation, and revision history.
4 //-----------------------------------------------------------------------------
5 //
6 // Copyright (c) 2018 Louis Dionne, Antony Polukhin
7 //
8 // Distributed under the Boost Software License, Version 1.0. (See
9 // accompanying file LICENSE_1_0.txt or copy at
10 // http://www.boost.org/LICENSE_1_0.txt)
11 
12 // This test checks that we can visit a variant containing a type that has
13 // internal linkage (anonymous namespace).
14 
15 #include "boost/variant/variant.hpp"
16 
17 #ifdef BOOST_NO_CXX14_DECLTYPE_AUTO
18 
run()19 void run() {}
20 
21 #else
22 
23 namespace {
24    struct Foo { };
25 
26    struct Visitor {
operator ()__anon4f1ee0610111::Visitor27       void operator()(Foo const&) const { }
28    };
29 }
30 
run()31 void run() {
32    boost::variant<Foo> v = Foo();
33    boost::apply_visitor(Visitor(), v);
34 }
35 
36 #endif
37 
main()38 int main() {
39    run();
40 }
41 
42