www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8695] New: ParameterStorageClassTuple doesn't recognize 'in' parameters

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695

           Summary: ParameterStorageClassTuple doesn't recognize 'in'
                    parameters
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com



07:40:04 PDT ---
import std.traits;

void foo(const scope int x) { }
void bar(in int x) { }

void main()
{
    alias ParameterStorageClass SC;
    alias ParameterStorageClassTuple SCT;

    static assert(SCT!foo[0] == SC.scope_);
    static assert(SCT!bar[0] == SC.scope_);
}

Error: static assert  (0u == cast(ParameterStorageClass)1u) is false

Since 'in' is equivalent to 'const scope' both asserts should pass.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 19 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695


Mihail Strashun <m.strashun gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |m.strashun gmail.com



PST ---
Somewhat similar, but for inout:

-----------------
import std.traits;

inout int func(inout int param)
{
    return param;
}

void main()    
{
    alias stcs = ParameterStorageClassTuple!(typeof(func));
    pragma(msg, stcs);
}
-----------------
/usr/local/include/dmd2/std/traits.d(97): Error: key 'g' not found in
associative array
['a':cast(FunctionAttribute)1u,'b':cast(FunctionAttribute)2u,'c':cast(FunctionAttribute)4u,'d':cast(FunctionAttribute)8u,'e':cast(FunctionAttribute)16u,'f':cast(FunctionAttribute)32u]
/usr/local/include/dmd2/std/traits.d(458): called from here:
demangleFunctionAttributes("NgiZi"c)
/usr/local/include/dmd2/std/traits.d(97): Error: key 'g' not found in
associative array
['a':cast(FunctionAttribute)1u,'b':cast(FunctionAttribute)2u,'c':cast(FunctionAttribute)4u,'d':cast(FunctionAttribute)8u,'e':cast(FunctionAttribute)16u,'f':cast(FunctionAttribute)32u]
/usr/local/include/dmd2/std/traits.d(458): called from here:
demangleFunctionAttributes("NgiZi"c)
/home/c565/c253.d(10): Error: template instance
std.traits.ParameterStorageClassTuple!(inout int(inout(int) param)) error
instantiating
demangleNextParameter!(demangleFunctionAttributes("NgiZi"c).rest)
-----------------

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695




PST ---
Hm, after some inspection it is not that related, I'll probably make a separate
bugzilla entry after scratching a fix.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Phobos                      |DMD





In current, dmd converts 'in' storage class to 'const', not 'const scpope'.
But, I'm not sure which is correct, a wrong spec issue or compiler
implementation bug.



ParameterStorageClassTuple and functionAttributes uses a private utility
demangleFunctionAttributes, but it does not recognize inout function.

For the latter, I opened a separate bug 9317.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695




07:34:33 PST ---


 
 In current, dmd converts 'in' storage class to 'const', not 'const scpope'.
 But, I'm not sure which is correct, a wrong spec issue or compiler
 implementation bug.
The spec page had not had 'in' documented for a long time, and we've discussed it many times where we said 'in' was 'const scope'. It's a compiler bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 14 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695







 
 In current, dmd converts 'in' storage class to 'const', not 'const scpope'.
 But, I'm not sure which is correct, a wrong spec issue or compiler
 implementation bug.
The spec page had not had 'in' documented for a long time, and we've discussed it many times where we said 'in' was 'const scope'. It's a compiler bug.
Even if it is correct, 'scope' storage class had not been discussed enough and its semantics had not been defined deeply. In recent Walter says about 'scope': "nobody has gotten around to it." https://github.com/D-Programming-Language/phobos/commit/ef0bed7d157afe5be5a69e17d5f30ffd309be527#commitcomment-2352989 So it seems to me that is yet not _defined_. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 14 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8695




07:52:49 PST ---

 In recent Walter says about 'scope': "nobody has gotten around to it."
 https://github.com/D-Programming-Language/phobos/commit/ef0bed7d157afe5be5a69e17d5f30ffd309be527#commitcomment-2352989
 
 So it seems to me that is yet not _defined_.
So basically it was a no-op all this time. We've been telling newcomers to D that 'in' means 'const scope' for the longest time. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jan 14 2013