www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8145] New: void template instantiation?

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

           Summary: void template instantiation?
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: websites
        AssignedTo: nobody puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs eml.cc 2012-05-24 14:57:18 PDT ---
This compiles with no errors nor warnings (dmd 2.060alpha):


struct Foo(T) {}
Foo!void f;
void main() {}


While a C++ compiler as G++ 4.7 gives:
error: ‘void’ is not a valid type for a template constant parameter

On IRC someone has said this is a feature of D. If this feature is present in D
docs then I suggest to make such note a bit more evident and to explain a bit
how this feature is useful. I think this is useful for C++ programmers.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 24 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8145


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #1 from Walter Bright <bugzilla digitalmars.com> 2012-05-24
16:41:02 PDT ---
I would think a note would be necessary to explain why void would be
disallowed. But I can't think of a reason for that. C++ disallowing it is not a
sufficient reason.

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


Walter Bright <bugzilla digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla digitalmars.com> 2012-05-24
16:42:25 PDT ---
I am going to mark this as invalid. If a sufficient rationale is presented, it
can be reopened.

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