Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split C++11-specific tests in their own file #9185

Merged
merged 3 commits into from
Jan 7, 2019
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
2 changes: 2 additions & 0 deletions src/dmd/cppmanglewin.d
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ public:
{
if (checkImmutableShared(type))
return;
if (checkTypeSaved(type))
return;

buf.writestring("$$T");
flags &= ~IS_NOT_TOP_TYPE;
Expand Down
34 changes: 34 additions & 0 deletions test/runnable/cpp11.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// DISABLED: win32
// REQUIRED_ARGS: -stdc++=c++11
// EXTRA_CPP_SOURCES: cpp11.cpp
// CXXFLAGS: -std=c++11

// Disabled on win32 because the compiler is too old

/****************************************/
alias nullptr_t = typeof(null);

// Only run on OSX/Win64 because the compilers are too old
// and nullptr_t gets substituted
version (FreeBSD)
version = IgnoreNullptrTest;
version (linux)
version = IgnoreNullptrTest;

version (IgnoreNullptrTest) { void test17() {} }
else
{
extern (C++) void testnull(nullptr_t);
extern (C++) void testnullnull(nullptr_t, nullptr_t);

void test17()
{
testnull(null);
testnullnull(null, null);
}
}

void main()
{
test17();
}
17 changes: 1 addition & 16 deletions test/runnable/cppa.d
Original file line number Diff line number Diff line change
Expand Up @@ -727,20 +727,6 @@ void test16()
static assert(0);
}

/****************************************/
/+ FIXME: Requires C++11 compiler.
alias nullptr_t = typeof(null);

extern (C++) void testnull(nullptr_t);
extern (C++) void testnullnull(nullptr_t, nullptr_t);

void test17()
{
testnull(null);
testnullnull(null, null);
}
+/

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

struct S13707
Expand Down Expand Up @@ -1624,7 +1610,6 @@ void main()
test13289();
test15();
test16();
//test17();
func13707();
func13932(S13932!(-1)(0));
foo13337(S13337());
Expand All @@ -1650,6 +1635,6 @@ void main()
test18966();
test19134();
test18955();

printf("Success\n");
}
13 changes: 13 additions & 0 deletions test/runnable/extra-files/cpp11.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>
#include <cstddef>

void testnull(std::nullptr_t n)
{
assert(n == nullptr);
}

void testnullnull(std::nullptr_t n1, std::nullptr_t n2)
{
assert(n1 == nullptr);
assert(n2 == nullptr);
}
14 changes: 0 additions & 14 deletions test/runnable/extra-files/cppb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,20 +464,6 @@ unsigned long testul(unsigned long ul)
return ul + sizeof(unsigned long);
}

/******************************************/
/* FIXME: Requires C++11 compiler.
void testnull(nullptr_t n)
{
assert(n == NULL);
}

void testnullnull(nullptr_t n1, nullptr_t n2)
{
assert(n1 == NULL);
assert(n2 == NULL);
}
*/

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

struct S13707
Expand Down
6 changes: 3 additions & 3 deletions test/tools/d_do_test.d
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,13 @@ int tryMain(string[] args)
{
case "dmd":
if(envData.os != "win32" && envData.os != "win64")
testArgs.requiredArgs ~= " -L-lstdc++";
testArgs.requiredArgs ~= " -L-lstdc++ -L--no-demangle";
break;
case "ldc":
testArgs.requiredArgs ~= " -L-lstdc++";
testArgs.requiredArgs ~= " -L-lstdc++ -L--no-demangle";
break;
case "gdc":
testArgs.requiredArgs ~= "-Xlinker -lstdc++";
testArgs.requiredArgs ~= "-Xlinker -lstdc++ -Xlinker --no-demangle";
break;
default:
writeln("unknown compiler: "~envData.compiler);
Expand Down