D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7680 - template specialization bug
Summary: template specialization bug
Status: NEW
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P3 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid
Depends on:
Blocks:
 
Reported: 2012-03-10 12:32 UTC by Martin Nowak
Modified: 2024-12-13 17:58 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 Martin Nowak 2012-03-10 12:32:24 UTC
cat > bug.d << CODE
struct Bar(T) {}
template Foo26(T:Bar!(const T))
{
    pragma(msg, "const", T);
}

template Foo26(T:Bar!(T))
{
    pragma(msg, "mod", T);
}

void main()
{
    alias Foo26!(Bar!int) foo;
}
CODE

dmd -c bug

--------

I'm not sure whether Bar!int should match Bar!(const T) in the first place.
However if it does it must be a MATCHconst.
Comment 1 Nick Treleaven 2023-02-28 18:20:32 UTC
The error is:

> tempspecconst.d(14): Error: template `tempspecconst.Foo26` matches more than one template declaration:

> I'm not sure whether Bar!int should match Bar!(const T) in the first place.

Well this fails so I'd say no:

    Bar!int b;
    Bar!(const int) c = b;
Comment 2 Nick Treleaven 2023-02-28 18:24:53 UTC
With only the top overload present, the code compiles even though the argument is `Bar!int`, not `Bar!(const int)`:

> template Foo26(T:Bar!(const T))
Comment 3 dlangBugzillaToGithub 2024-12-13 17:58:59 UTC
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18424

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB