www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10212] New: Segfault using wrong delegate literal syntax, wrong error message

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

           Summary: Segfault using wrong delegate literal syntax, wrong
                    error message
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: henning still-hidden.de



PDT ---
int delegate() foo() {
    return () => {
        return 1;
    };
}

void main() {
}

-----
main.d(2): Error: mismatched function return type inference of int function()
pure nothrow  safe and int
Segmentation fault (core dumped)
-----

Also the return type of foo is not int, it is int delegate().

Doesn't segfault using GDC/LDC 2.060 on dpaste.

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




PDT ---
I know it's a bad time to come up with a regression :S

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


Iain Buclaw <ibuclaw ubuntu.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw ubuntu.com



Note:  is a front-end bug so is present in current gdc development.

Backtrace:

0x5e7a18 Type::covariant(Type*, unsigned long*)
0x5795c9 FuncExp::castTo(Scope*, Type*)
0x5bf988 FuncDeclaration::semantic3(Scope*)
0x59d8f6 FuncExp::semantic(Scope*)
0x60f74a ReturnStatement::semantic(Scope*)
0x610b8c CompoundStatement::semantic(Scope*)
0x5bf8bb FuncDeclaration::semantic3(Scope*)
0x5f2307 Module::semantic3()

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Segfault using wrong        |Segfault in mismatching
                   |delegate literal syntax,    |delegate literal types
                   |wrong error message         |




 int delegate() foo() {
     return () => {
         return 1;
     };
 }
 Also the return type of foo is not int, it is int delegate().
It is not wrong delegate syntax. The code is just equivalent with follows: int delegate() foo() { return (){ return (){ // L3 return 1; }; }; } And reported error is changed to: test.d(3): Error: mismatched function return type inference of int function() pure nothrow safe and int The outer lambda should return int, because the lambda type should be deduced to int delegate(). But it returns an inner lambda, which has the type "int function() pure nothrow safe". Then it conflicts with expected return type "int". Reported error message is not wrong, too. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10212


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/dmd/pull/2101

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




Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e1ac707489c96bbc6bfd78e584d1c0665b6136fa
fix Issue 10212 - Segfault in mismatching delegate literal types

https://github.com/D-Programming-Language/dmd/commit/3a436b8177f931e2230695da095599bf69966d1a


[REG2.061] Issue 10212 - Segfault in mismatching delegate literal types

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


Henning Pohl <henning still-hidden.de> changed:

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


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




Commit pushed to 2.063 at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/47260a9a67112d55698ff6bb1a374cd7bc44d500


[REG2.061] Issue 10212 - Segfault in mismatching delegate literal types

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