[Issue 8683] bad type resolution for template property functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Oct 5 10:47:42 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8683


Maxim Fomin <maxim at maxim-fomin.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |maxim at maxim-fomin.ru


--- Comment #2 from Maxim Fomin <maxim at maxim-fomin.ru> 2012-10-05 10:35:47 PDT ---
(In reply to comment #0)
>
<skip>

It may or may not be a bug depending on what spec says and it says little about
it. Dlang.org template page says that semantic analysis is done after template
instantiation and in your case it is not instantiated. On the one hand, it is
obvious that return type does not vary and is always int. On the other hand,
dmd is not obligated to do so until full template instantiation. 

TDPL p.139-140 says that D uses heterogeneous translation which means that int
Foo()() is not a compiled function like int Goo(). At p.236 it additionally
says that Foo()() is not a type, it's a means to create a type. This means that
asking a typeof from something that is not a type is problematic.

The key point here is whether typeof(Foo) should instantiate type or not for
templates like Foo. If it should instantiate, then it should correctly parse
return type. If not (and it seems that typeof of templates which cannot be
easily instantiated as Foo), than typeof should return some invalid type (like
void) or just issue error.

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


More information about the Digitalmars-d-bugs mailing list