www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5721] New: dmd fails to properly differentiate between a function and an eponymous template with the same name

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

           Summary: dmd fails to properly differentiate between a function
                    and an eponymous template with the same name
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com



PST ---
This code:

import std.string;
import std.traits;

void main()
{
    isNumeric("hello world");
}


fails to compile, giving this error:

std/traits.d(2576): Error: template std.traits.isNumeric(T) is not a function
template


There should be no confusion between std.string.isNumeric (which is a normal
function - not even a templated function) and std.traits.isNumeric (which is an
eponymous template). The syntax for each is quite distinct. There shouldn't be
any confusion. One takes a variable as a function argument. The other takes a
type as a templated argument.

_Worst_ case, this should complain that you need to specify which of the two
isNumerics that you mean, but it should be quite clear which is meant, so
ideally, it should just work with no error at all. Regardless, the error given
really shouldn't be given. Either this needs to be fixed to work properly or a
better error message needs to be given (similar to what occurs when you have
ambiguity between overload sets).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 08 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5721


Mike Wey <mike-wey planet.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mike-wey planet.nl
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 2329 ***

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