Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Merged
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
10 changes: 8 additions & 2 deletions src/core/exception.d
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,20 @@ extern (C) void onInvalidMemoryOperationError(void* pretend_sideffect = null) @t
*/
extern (C) void onSwitchError( string file = __FILE__, size_t line = __LINE__ ) @safe pure nothrow
{
throw new SwitchError( file, line, null );
version (D_Exceptions)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding a comment here that this is temporary, and that once we get either a pure malloc, or an alloca for -betterC that these should be changed to an assert for both cases. Either that, or file a bugzilla issue with the same.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discussion doesn't need to hold up resolving issue #19087.

throw new SwitchError( file, line, null );
else
assert(0, "No appropriate switch clause found");
}

// Compiler lowers final switch default case to this (which is a runtime error)
void __switch_errorT()(string file = __FILE__, size_t line = __LINE__) @trusted
{
// Consider making this a compile time check.
throw staticError!SwitchError(file, line, null);
version (D_Exceptions)
throw staticError!SwitchError(file, line, null);
else
assert(0, "No appropriate switch clause found");
}

/**
Expand Down