D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 6527 - Ambiguous mangling of inout parameters
Summary: Ambiguous mangling of inout parameters
Status: RESOLVED WONTFIX
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other All
: P2 normal
Assignee: No Owner
URL:
Keywords: bootcamp
Depends on:
Blocks:
 
Reported: 2011-08-18 09:26 UTC by Sean Kelly
Modified: 2017-04-14 16:42 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Sean Kelly 2011-08-18 09:26:16 UTC
An inout(T) function parameter is represented as "NgT" (ie. Wild T, per the ABI).  'N' is already used as the signifier for a FuncAttr, so this function:

   nothrow inout(int) fn(inout(int) x) { return x; }

Is mangled as:

   2fnFNbNgiZNgi

Parsing this, I have to explicitly recognize "Ng" as not a FuncAttr but rather the beginning of an inout parameter type, rewind the parse location (admittedly by one char) and jump out of the FuncAttr parse loop to deal with it.  Couldn't some other label be used to mark an inout parameter so this conflict doesn't exist?  I guess TypeNewArray might have this same problem ("Ne") except that it isn't even used in D2 right now so I suppose that's a non-issue.
Comment 1 Rainer Schuetze 2017-04-14 16:42:00 UTC
Two character manglings are common by now and no single character encodigs left, so the demangler should be able to look-ahead by the additional character (and mostly does).