www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5461] New: Invalid declaration for auto functions in .di files generated by DMD -H

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

           Summary: Invalid declaration for auto functions in .di files
                    generated by DMD -H
           Product: D
           Version: D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: dransic free.fr



When compiling "complex" non-templated auto functions, e.g.:

auto foo() {
    struct Bar {
        int a;
    }
    auto bar = Bar(42);
    return bar;
}

with -H option, the generated .di file contains:

auto foo();

which is a (rightly) invalid declaration statement. I think that either foo's
body should be included in the .di file or that a warning/error should be
thrown on compilation of such a function with the -H switch.

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




Created an attachment (id=872)
patch of func.c in DMD 2.051

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


SomeDude <lovelydear mailmetrash.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lovelydear mailmetrash.com



PDT ---
With 2.059

dmd -H now produces:

// D import file generated from 'bug.d'
import std.stdio;
struct Foo
{
    int x;
}
void main();

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


Trass3r <mrmocool gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mrmocool gmx.de



?
git dmd still produces 'auto foo();' for me.

I think the patch could be more complex though.
If it's a Voldemort type the whole body needs to be included.
But what if it's a "simple" type? Then you could just print out the inferred
type.

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


LightBender <adamw prospectivesoftware.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |adamw prospectivesoftware.c
                   |                            |om



09:57:54 PDT ---

 ?
 git dmd still produces 'auto foo();' for me.
 
 I think the patch could be more complex though.
 If it's a Voldemort type the whole body needs to be included.
 But what if it's a "simple" type? Then you could just print out the inferred
 type.
This pull fixes this problem and a bunch of others: https://github.com/D-Programming-Language/dmd/pull/928. However, it currently fails to build on Linux and fails the unittests on Windows thanks to a problem with the dur template function in std.datetime. The solution used by this pull is to include the function body of the auto-function as that was needed to allow Phobos to build correctly using the DRT DI files. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5461




10:04:56 PDT ---


 ?
 git dmd still produces 'auto foo();' for me.
 
 I think the patch could be more complex though.
 If it's a Voldemort type the whole body needs to be included.
 But what if it's a "simple" type? Then you could just print out the inferred
 type.
This pull fixes this problem and a bunch of others: https://github.com/D-Programming-Language/dmd/pull/928. However, it currently fails to build on Linux and fails the unittests on Windows thanks to a problem with the dur template function in std.datetime. The solution used by this pull is to include the function body of the auto-function as that was needed to allow Phobos to build correctly using the DRT DI files.
I forgot to mention that DMD does not know the type of an auto-function when DI files are generated. No semantic analysis has been performed and since semantic analysis could change the layout of a module you wouldn't want it to be performed. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 09 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5461


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
           Platform|Other                       |All
         Resolution|                            |FIXED



14:59:22 PST ---
https://github.com/D-Programming-Language/dmd/pull/1487

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 16 2013