[Issue 3396] Call of abstract method not detected by semantic check

2014-08-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #13 from yebblies yebbl...@gmail.com ---
(In reply to Stewart Gordon from comment #11)
  The compiler cannot tell the difference between d files and di files...
 
 How do you mean, the compiler can't know the filename extension of the file
 passed into it?

It could, but it doesn't, and it shouldn't.  d files and di files are the same
thing to the compiler.

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #14 from yebblies yebbl...@gmail.com ---
(In reply to Stewart Gordon from comment #12)
 http://dlang.org/function.html
 Functions without bodies:
 
 int foo();
 
 that are not declared as abstract are expected to have their implementations
 elsewhere, and that implementation will be provided at the link step.
 
 Where does the spec indicate that functions that _are_ declared as abstract
 can also have their implementations elsewhere?

Where does it say that they can't?

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-12 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #15 from Stewart Gordon s...@iname.com ---
(In reply to yebblies from comment #14) 
 Where does it say that they can't?

If such code is legal, the spec needs to explain its semantics somewhere.

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

yebblies yebbl...@gmail.com changed:

   What|Removed |Added

 CC||blah38...@gmail.com

--- Comment #5 from yebblies yebbl...@gmail.com ---
*** Issue 13278 has been marked as a duplicate of this issue. ***

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #7 from Denis Shelomovskij verylonglogin@gmail.com ---
(In reply to yebblies from comment #6)
 This code:
 
 abstract class A
 {
abstract void M();
 }
 
 could mean one of two things:
 1. M is a pure virtual function
 2. M provides 'base class functionality', but this is a di file so the body
 isn't present.

You misuse terminology. pure virtual function is a C++ term which means this
function should be overriden to be able to instantiate class. There is no term
for function that doesn't provide base class functionality. So D's 'abstract'
means exactly what C++'s '=0' postfix does marking function pure virtual in
contrast to e.g. C#'s 'abstract'.

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #8 from yebblies yebbl...@gmail.com ---
(In reply to Denis Shelomovskij from comment #7)
 (In reply to yebblies from comment #6)
  This code:
  
  abstract class A
  {
 abstract void M();
  }
  
  could mean one of two things:
  1. M is a pure virtual function
  2. M provides 'base class functionality', but this is a di file so the body
  isn't present.
 
 You misuse terminology. pure virtual function is a C++ term which means
 this function should be overriden to be able to instantiate class. There
 is no term for function that doesn't provide base class functionality. So
 D's 'abstract' means exactly what C++'s '=0' postfix does marking function
 pure virtual in contrast to e.g. C#'s 'abstract'.

I figured people would understand what I meant.  1) is a function that has no
implementation.

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #9 from Orvid King blah38...@gmail.com ---
Isn't it still reasonable for DMD to at least catch this error at compile-time 
rather than link-time if the module containing class A was passed on the 
command line, and thus is one of those being compiled, and not an interface?

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #10 from yebblies yebbl...@gmail.com ---
(In reply to Orvid King from comment #9)
 Isn't it still reasonable for DMD to at least catch this error at
 compile-time 
 rather than link-time if the module containing class A was passed on the 
 command line, and thus is one of those being compiled, and not an interface?

The compiler cannot tell the difference between d files and di files...  And
technically you're allowed to put the implementation in a library, implement it
in asm, etc

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #11 from Stewart Gordon s...@iname.com ---
(In reply to Orvid King from comment #9)
 Isn't it still reasonable for DMD to at least catch this error at
 compile-time 
 rather than link-time if the module containing class A was passed on the 
 command line, and thus is one of those being compiled, and not an interface?

This would break tools such as bud.

(In reply to yebblies from comment #10)
 The compiler cannot tell the difference between d files and di files...

How do you mean, the compiler can't know the filename extension of the file
passed into it?

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-08-11 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

--- Comment #12 from Stewart Gordon s...@iname.com ---
http://dlang.org/function.html
Functions without bodies:

int foo();

that are not declared as abstract are expected to have their implementations
elsewhere, and that implementation will be provided at the link step.

Where does the spec indicate that functions that _are_ declared as abstract can
also have their implementations elsewhere?

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

Denis Shelomovskij verylonglogin@gmail.com changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||verylonglogin@gmail.com
   Hardware|x86 |All
 Resolution|--- |INVALID
 OS|Windows |All

--- Comment #3 from Denis Shelomovskij verylonglogin@gmail.com ---
This is a documented and intended behavior. According to [1]:
 Functions declared as abstract can still have function bodies. This is so 
 that even though they must be overridden, they can still provide ‘base class 
 functionality.’

It also maches C++ behavior with respect to pure virtual functions.

An enhancement request to change it may be opened but this bug is invalid.

[1] http://dlang.org/attribute.html#abstract

--


[Issue 3396] Call of abstract method not detected by semantic check

2014-07-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=3396

Stewart Gordon s...@iname.com changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
 Resolution|INVALID |---

--- Comment #4 from Stewart Gordon s...@iname.com ---
(In reply to Denis Shelomovskij from comment #3)
 This is a documented and intended behavior. According to [1]:
 Functions declared as abstract can still have function bodies.  

But A.M has no function body.  So what's the relevance?

 This is so that even though they must be overridden, they can 
 still provide ‘base class functionality.’

But no base class functionality has been provided.  As such, the compiler
cannot resolve the call to super.M and therefore should error.

 It also maches C++ behavior with respect to pure virtual functions.

What exactly does the C++ standard say about this?

That said, is C++ behaviour relevant?  D is not C++.

--


[Issue 3396] Call of abstract method not detected by semantic check

2012-02-10 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3396


Stewart Gordon s...@iname.com changed:

   What|Removed |Added

   Keywords||accepts-invalid
 CC||s...@iname.com


--- Comment #2 from Stewart Gordon s...@iname.com 2012-02-10 10:45:07 PST ---
(In reply to comment #1)
 Created an attachment (id=1072) [details]
 abstract methods not being flagged as unimplemented

AIUI a method declared without the abstract attribute is taken to reference a
function defined elsewhere.  Since no library or object file that defines such
a function has been linked in, the linker errors.

The original testcase is different: A.m is declared as abstract, so the
compiler should reject the attempt to call it there and then.

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


[Issue 3396] Call of abstract method not detected by semantic check

2012-02-06 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=3396



--- Comment #1 from rjmcgu...@gmail.com 2012-02-06 04:07:53 PST ---
Created an attachment (id=1072)
abstract methods not being flagged as unimplemented

I encountered this problem in a library, what I found interesting was that the
program compiled and ran without crashing, just had empty output where I was
expecting text.
Attachment is a simpler test case with similar outcome:

$ dmd test.d
test.o:(.rodata+0xb0): undefined reference to `_D4test1A2a1MFZAya'
collect2: ld returned 1 exit status
--- errorlevel 1

$ dmd -c test.d
$

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