Thread overview
[Issue 8928] New: Poor error message for derived class without constructor
Nov 01, 2012
Don
Nov 02, 2012
Andrej Mitrovic
Nov 02, 2012
Jonathan M Davis
Nov 02, 2012
Andrej Mitrovic
Nov 02, 2012
Andrej Mitrovic
Nov 02, 2012
Jonathan M Davis
Nov 29, 2012
Andrej Mitrovic
Dec 28, 2012
Walter Bright
November 01, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928

           Summary: Poor error message for derived class without
                    constructor
           Product: D
           Version: D1 & D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2012-11-01 05:09:18 PDT ---
class X {
   this(int n) {}
}

class Y : X { }

qef.d(5): Error: constructor qef.Y.this no match for implicit super() call in
constructor
----
But Y doesn't have a constructor!

Seems the compiler generates an implicit constructor, and then complains that it's erroneous.

Actually I'm not sure why it doesn't generate this(int n) { super(n); }, but
that's a different issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-11-01 22:26:45 PDT ---
How about:

Error: synthesized constructor qef.Y.this no match for implicit super() call in
constructor

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928


Jonathan M Davis <jmdavisProg@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jmdavisProg@gmx.com


--- Comment #2 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-11-01 22:42:08 PDT ---
"Synthesized?" That's a very odd choice of words, and actually, I'd argue that it's outright incorrect. How about something more like

Error: Cannot generate default constructor for qef.Y, because its base class, qef.X, has no default constructor.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928



--- Comment #3 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-11-01 22:48:02 PDT ---
(In reply to comment #2)
> "Synthesized?" That's a very odd choice of words, and actually, I'd argue that it's outright incorrect.

It's standard terminology, you can look up the C++ reference manual if you wish.

Here's a sample g++ error when the compiler implicitly generates a method:

/usr/include/c++/4.4/iosfwd:56: note: synthesized method ‘std::basic_ios >& std::basic_ios >::operator=(const std::basic_ios >&)’ first required here

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-11-01 22:48:53 PDT ---
(In reply to comment #3)
> (In reply to comment #2)
> > "Synthesized?" That's a very odd choice of words, and actually, I'd argue that it's outright incorrect.
> 
> It's standard terminology

But I'm not saying it's the best choice of words. So suggestions are welcome.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 02, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928



--- Comment #5 from Jonathan M Davis <jmdavisProg@gmx.com> 2012-11-01 23:13:41 PDT ---
Well, it really doesn't match the definition of synthesized at all, so I have to wonder about whoever picked it for C++. Regardless, using it in an error message like that isn't going to be clear to most programmers.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 29, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928


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

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


--- Comment #6 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-11-29 14:42:53 PST ---
https://github.com/D-Programming-Language/dmd/pull/1336

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 09, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928



--- Comment #7 from github-bugzilla@puremagic.com 2012-12-09 09:59:51 PST ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/6a4840212b1ee0611c9c8fecc59ec8500e8999ea Fixes Issue 8928 - Improve error message with implicitly generated constructor.

https://github.com/D-Programming-Language/dmd/commit/4cc63a038e27356d5d60a93e57b794b37167cab0 Merge pull request #1336 from AndrejMitrovic/Fix8928

[diag] Issue 8928 - Improve error message with implicitly generated constructor

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
December 28, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8928


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


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