Bug 5962 – Template function declaration with prefixed storage class and auto occurs conflict

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-08T14:30:00Z
Last change time
2011-07-01T18:18:21Z
Keywords
rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2011-05-08T14:30:40Z
Following code compilation with -version=Prefix fails, but with -version=Suffix succeeds. ---- struct S { version(Prefix) { auto g()(){ return 1; } const auto g()(){ return 2; } } version(Suffix) { auto g()() { return 1; } auto g()() const{ return 2; } } } void main() { auto ms = S(); assert(ms.g() == 1); auto cs = const(S)(); assert(cs.g() == 2); } ----
Comment #1 by bearophile_hugs — 2011-05-08T15:11:56Z
Is this bug 4040 ?
Comment #2 by k.hara.pg — 2011-05-08T15:16:51Z
(In reply to comment #1) > Is this bug 4040 ? No. This issue is that passes on parsing but fails on semantic. Bug 4040 is that fails on parsing.
Comment #3 by k.hara.pg — 2011-05-08T15:56:10Z
Applying const/immutable/shared storage_class to function type is done in FuncDeclaration::semantic, but template function lookup is before running it. So deducing function template with FuncDeclaration::type that not applied storage classes occurs conflict.
Comment #4 by bugzilla — 2011-07-01T18:18:21Z