Bug 55400 - MCS produces incorrect code for generic instantiated with a gtd
Summary: MCS produces incorrect code for generic instantiated with a gtd
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 5.0.0 (2017-02)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2017-04-19 18:56 UTC by Aleksey Kliger
Modified: 2017-05-24 17:30 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Repro.cs (324 bytes, text/plain)
2017-04-19 18:56 UTC, Aleksey Kliger
Details

Description Aleksey Kliger 2017-04-19 18:56:40 UTC
Created attachment 21640 [details]
Repro.cs

Reproduction:
  1.  mcs Repro.cs
  2.  csc Repro.cs

Expected Result:
  Both mcs and csc produce the error:
     error CS7003: Unexpected use of an unbound generic name

Actual Result:
  csc gives an error.  mcs produces an assembly with the following Main:
  .method public hidebysig static void  Main(string[] args) cil managed
  {
    .entrypoint
    // Code size       18 (0x12)
    .maxstack  1
    .locals init (class [mscorlib]System.Type V_0)
    IL_0000:  ldtoken    Test.B`1
    IL_0005:  call       class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
    IL_000a:  stloc.0
    IL_000b:  ldloc.0
    IL_000c:  call       void [mscorlib]System.Console::WriteLine(object)
    IL_0011:  ret
  } // end of method Repro::Main

ie, it actually just behaves as if I wrote typeof (Test.B<>)
Comment 1 Marek Safar 2017-05-24 17:30:45 UTC
Fixed in master

Note You need to log in before you can comment on or make changes to this bug.