Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Issue 9336 - Format should work on shared address. #1098

Merged
merged 1 commit into from

2 participants

@AndrejMitrovic
Collaborator

http://d.puremagic.com/issues/show_bug.cgi?id=9336

I don't think it will cause any problems having the pointer typed to its element type rather than typed to void, since:

pointer -> qualifier -> type

implicitly converts to:

pointer -> qualifier -> void

If this isn't always true than we could either force a cast to const(void*) or use some kind of template helper to extract a const(qualified(pointer to void)). Anyway the address is formatted and not the pointed value so I don't think the pointed type is all that important.

@alexrp alexrp merged commit 9e42f2a into from
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@ghost Unknown referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 1 deletion.
  1. +7 −1 std/format.d
View
8 std/format.d
@@ -2842,7 +2842,7 @@ if (isPointer!T && !is(T == enum) && !hasToString!(T, Char))
}
else
{
- const void * p = val;
+ const p = val;
if (f.spec == 's')
{
FormatSpec!Char fs = f; // fs is copy for change its values.
@@ -2899,6 +2899,12 @@ unittest
formatTest( B.init, "null" );
}
+unittest
+{
+ // Test for issue 9336
+ shared int i;
+ format("%s", &i);
+}
/**
Delegates are formatted by 'Attributes ReturnType delegate(Parameters)'
Something went wrong with that request. Please try again.