www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 6661] New: Templates instantiated only through is(typeof()) shouldn't cause errors

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

           Summary: Templates instantiated only through is(typeof())
                    shouldn't cause errors
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: clugdbug yahoo.com.au



The template blaz!int cannot be instantiated without errors, because it
contains an assignment of a string literal to int. But, since it is not
actually instantiated, it shouldn't cause a compile error.

template blaz(Q)
{
    int qutz(Q y)
    {
        Q q = "abc";
        return 67;
    }
    static assert(qutz(13).sizeof!=299);
    const Q blaz = 6;
}

static assert(is(typeof(blaz!(int).blaz)));

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 13 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6661


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



00:45:10 PDT ---
D2 fix:
https://github.com/D-Programming-Language/dmd/commit/0a927f258e89f92f280c0e855a93ceb05e34a260

Partial D1 fix:
https://github.com/D-Programming-Language/dmd/commit/31d6751de3a877c72055a2096a9a9c4a9a25ec9b

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6661


Walter Bright <bugzilla digitalmars.com> changed:

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



11:24:07 PDT ---
D1 fix:
https://github.com/D-Programming-Language/dmd/commit/23846aca52ebd21efab36ff32924c5a6cc17c4c0

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6661


Denis <verylonglogin.reg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |verylonglogin.reg gmail.com
         Resolution|FIXED                       |



---
Still in dmd-1.x branch (tested after fe308a1).
Compiler fails with exit code 1 and no error messages.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 15 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6661


Walter Bright <bugzilla digitalmars.com> changed:

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



22:51:56 PDT ---
https://github.com/D-Programming-Language/dmd/commit/7654a72e61b1ae322b9f55bbff97ea1c36db4622

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

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Oct 16 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6661




*** Issue 6262 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 21 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6661




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

https://github.com/D-Programming-Language/dmd/commit/e9142862884625d0db801bbf1f05ad9487aae28b
fix test result for issue 6661

Inherently, when you try to instantiate a template, the whole template
body correctness should be checked at the same time.

In this case, bug6661!(int).qutz is a normal function declared inside
template, so it should be instantiated at the same time with bug6661!(int).
Now, the inner `static assert(qutz(13).sizeof!=299);` runs the semantic3
of qutz by calling it. So the module level static assertion fails _correctly_.

But, `is(typeof(bug6661x!(int)))` still returns true incorrectly.
I think it is yet another known issue in current dmd implementation.

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