D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 5721 - dmd fails to properly differentiate between a function and an eponymous template with the same name
Summary: dmd fails to properly differentiate between a function and an eponymous templ...
Status: RESOLVED DUPLICATE of issue 2329
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-08 16:21 UTC by Jonathan M Davis
Modified: 2015-06-09 05:14 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Jonathan M Davis 2011-03-08 16:21:02 UTC
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).
Comment 1 Mike Wey 2011-06-18 03:45:18 UTC

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