Thread overview
[Issue 5962] New: Template function declaration with prefixed storage class and auto occurs conflict
May 08, 2011
Kenji Hara
May 08, 2011
Kenji Hara
May 08, 2011
Kenji Hara
Jul 02, 2011
Walter Bright
May 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5962

           Summary: Template function declaration with prefixed storage
                    class and auto occurs conflict
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: k.hara.pg@gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg@gmail.com> 2011-05-08 14:30:40 PDT ---
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);
}
----

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5962


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2011-05-08 15:11:56 PDT ---
Is this bug 4040 ?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5962



--- Comment #2 from Kenji Hara <k.hara.pg@gmail.com> 2011-05-08 15:16:51 PDT ---
(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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5962



--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2011-05-08 15:56:10 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 02, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5962


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla@digitalmars.com> 2011-07-01 18:18:21 PDT ---
https://github.com/D-Programming-Language/dmd/commit/781df821312d9350e9e750993b77ff43c0c8e30d

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