Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 35 additions & 29 deletions test/runnable/cppa.d
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ version (linux)

extern (C++, std)
{
struct allocator(T)
extern (C++, class) struct allocator(T)
{
version (linux)
{
Expand All @@ -459,45 +459,42 @@ extern (C++, std)
}
}

version (linux)
class vector(T, A = allocator!T)
{
class vector(T, A = allocator!T)
{
final void push_back(ref const T);
}
final void push_back(ref const T);
}

struct char_traits(T)
{
}
struct char_traits(T)
{
}

// https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
version (none)
{
extern (C++, __cxx11)
{
struct basic_string(T, C = char_traits!T, A = allocator!T)
{
}
}
}
else
// https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html
version (none)
{
extern (C++, __cxx11)
{
struct basic_string(T, C = char_traits!T, A = allocator!T)
{
}
}

struct basic_istream(T, C = char_traits!T)
}
else
{
extern (C++, class) struct basic_string(T, C = char_traits!T, A = allocator!T)
{
}
}

struct basic_ostream(T, C = char_traits!T)
{
}
struct basic_istream(T, C = char_traits!T)
{
}

struct basic_iostream(T, C = char_traits!T)
{
}
struct basic_ostream(T, C = char_traits!T)
{
}

struct basic_iostream(T, C = char_traits!T)
{
}

class exception { }
Expand Down Expand Up @@ -1593,6 +1590,14 @@ void test19134()
assert(d.foo() == 660);
}

// https://issues.dlang.org/show_bug.cgi?id=18955
alias std_string = std.basic_string!(char);

extern(C++) void callback18955(ref const(std_string) str)
{
}
extern(C++) void test18955();

/****************************************/

void main()
Expand Down Expand Up @@ -1643,6 +1648,7 @@ void main()
test18953();
test18966();
test19134();

test18955();

printf("Success\n");
}
31 changes: 31 additions & 0 deletions test/runnable/extra-files/cppb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,3 +933,34 @@ void A18966::foo() { calledOverloads[i++] = 'A'; }

B18966::B18966() { foo(); }
void B18966::foo() { calledOverloads[i++] = 'B'; }

#if _WIN32 // otherwise defined in C header files!
// https://issues.dlang.org/show_bug.cgi?id=18955
namespace std
{
template<typename Char>
struct char_traits
{
};
template<typename Char>
class allocator
{
};
template<typename Char, typename Traits, typename Alloc>
class basic_string
{
};
typedef basic_string<char, char_traits<char>, allocator<char> > string;
}
#endif // _WIN32

void callback18955(const std::string& s);

void test18955()
{
std::string s;
// TODO: on OSX and FreeBSD, std is mangled as std::__1
#if !__APPLE__ && !__FreeBSD__
callback18955(s);
#endif
}