Thread overview
[Issue 10099] New: Diagnostic for disable default construction should improve
May 17, 2013
Andrej Mitrovic
[Issue 10099] Diagnostic for disabled default construction should improve
May 18, 2013
Kenji Hara
May 18, 2013
Andrej Mitrovic
May 18, 2013
Andrej Mitrovic
Sep 19, 2013
Andrej Mitrovic
Sep 19, 2013
Kenji Hara
May 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099

           Summary: Diagnostic for disable default construction should
                    improve
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: andrej.mitrovich@gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-05-16 19:05:06 PDT ---
-----
struct S
{
    int x;
    @disable this();
    this(int x) { }
}

void main()
{
    S s;  // L12
}
-----

> test.d(12): Error: variable test.main.s initializer required for type S

This should really be:

> test.d(12): Error: struct test.S cannot be default-initialized because it has a default constructor annotated with @disable

This would be similar to:

-----
struct S
{
    @disable this(this);
}

void main()
{
    S s;
    S s2 = s;
}
-----

> test.d(11): Error: struct test.S is not copyable because it is annotated with @disable

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099



--- Comment #1 from Kenji Hara <k.hara.pg@gmail.com> 2013-05-18 08:04:46 PDT ---
> test.d(12): Error: struct test.S cannot be default-initialized because it has a default constructor annotated with @disable

It seems to me that is a little long message. More shorter is better.

With new expression:

struct S {
    @disable this();
}
class C {
    S s;
}
void main() {
    auto x = new C();
}

test.d(11): Error: default construction is disabled for type C

How about using "default construction is disabled for type XXX"?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-05-18 12:17:01 PDT ---
(In reply to comment #1)
> > test.d(12): Error: struct test.S cannot be default-initialized because it has a default constructor annotated with @disable
> 
> It seems to me that is a little long message. More shorter is better.

Yes, bad example. Anything is better than that "initializer required for..".

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 18, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-05-18 12:17:21 PDT ---
(In reply to comment #1)
> How about using "default construction is disabled for type XXX"?

Perfect.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
         AssignedTo|nobody@puremagic.com        |andrej.mitrovich@gmail.com


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-09-18 18:00:41 PDT ---
https://github.com/D-Programming-Language/dmd/pull/2572

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099



--- Comment #5 from github-bugzilla@puremagic.com 2013-09-18 21:53:46 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/1ecb4525bfb3b2d76c78e0b1d5c6a822e2411a02 Fixes Issue 10099 - Better diagnostic for a disabled default constructor.

https://github.com/D-Programming-Language/dmd/commit/6380eae1fd53cdcb5a576e7572bc9349d9b95467 Merge pull request #2572 from AndrejMitrovic/Fix10099

Issue 10099 - Better diagnostic for a disabled default constructor.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 19, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10099


Kenji Hara <k.hara.pg@gmail.com> 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: -------