www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8427] New: [2.060 beta] static foreach over typesafe vararg rejected

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

           Summary: [2.060 beta] static foreach over typesafe vararg
                    rejected
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: cbkbbejeap mailinator.com



15:49:52 PDT ---
void foo(T...)(T args)
{
    foreach(T arg; args)
    {}
}

void main()
{
    foo("", [""]);
}

Works in 2.059, but not in 2.060 beta:

testTypeSafeVarArg.d(1): Error: cannot implicitly convert expression (_param_0)
of type string to string[]
testTypeSafeVarArg.d(1): Error: cannot implicitly convert expression (_param_1)
of type string[] to string
testTypeSafeVarArg.d(9): Error: template instance
testTypeSafeVarArg.foo!(string,string[]) error instantiating

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


klickverbot <code klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code klickverbot.at



---
foreach(T arg; args) – sure about that T there?

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


Simen Kjaeraas <simen.kjaras gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |simen.kjaras gmail.com



PDT ---

 foreach(T arg; args) – sure about that T there?
As Nick stated in the report, it compiles under 2.059. However, void foo(T...)(T args) { foreach(T arg; args) { pragma(msg, typeof(arg)); pragma(msg, T); } } void main() { foo("", [""]); } Should prove that the T is being ignored in 2.059, and as such it accepts invalid code. This is not a regression, it's a fix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 24 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8427


Nick Sabalausky <cbkbbejeap mailinator.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID



17:32:58 PDT ---
Fuck, good catch! Never mind me. Carry on ;)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 24 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8427




The original issue that fixed in 2.060beta is bug 5435.
Then, if you iterate a tuple that has heterogeneous elements, you should not
add type for foreach argument.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 24 2012