www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2015] New: Virtual template methods are allowed

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

           Summary: Virtual template methods are allowed
           Product: D
           Version: 1.028
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: dvdfrdmn users.sf.net


Compiler allows the following:

--
class X
{
    void f(T)() { }
}
void main() { (new X).f!(int)(); }
--

This is due (at least partially) to the use of toParent() instead of
toParent2() to in FuncDeclaration::semantic, FuncDeclaration::isVirtual, and
Dsymbol::isMember.


-- 
Apr 19 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2015


kamm-removethis incasoftware.de changed:

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





-------
Maybe add the implementation hint to bug 566 as well.

*** This bug has been marked as a duplicate of 566 ***


-- 
Apr 19 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2015


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |
            Summary|Virtual template methods are|Interface template methods
                   |allowed                     |are allowed





This actually came from a SourceForge bug report.  The original specifies
interface methods.  In this case, the code fails to link, but there should be a
proper error message.
----
interface TestInterface 
  { void tpl(T)(); }
class TestImplementation : TestInterface 
  { void tpl(T)() { } }

void main()
{
  /* TestImplementation t = new TestImplementation(); // works */

  TestInterface t = new TestImplementation(); // fails

  t.tpl!(int)();
}
---


-- 
Apr 19 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2015


dvdfrdmn users.sf.net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |DUPLICATE





Oops, didn't realize 566 was still open.

*** This bug has been marked as a duplicate of 566 ***


-- 
Apr 19 2008