D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 12426 - Spurious "auto can only be used for template function parameters" for overloaded templated functions
Summary: Spurious "auto can only be used for template function parameters" for overloa...
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 major
Assignee: No Owner
URL:
Keywords: diagnostic, rejects-valid
Depends on:
Blocks:
 
Reported: 2014-03-20 10:40 UTC by Vladimir Panteleev
Modified: 2020-03-21 03:56 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Vladimir Panteleev 2014-03-20 10:40:17 UTC
///////// test.d ////////
void fun(T)(auto ref T t)
    if (false)
{
}

void fun(T)()
{
}

alias fun!int funint;
/////////////////////////

Compiler complains:
test.d(1): Error: auto can only be used for template function parameters

Not only is this error spurious (the constraint will never pass), but the compiler does not indicate the location of the instantiation.