Skip to content

Standalone deriving of an unsupported class panics GHC

Using standalone deriving on a non-standard class, without GeneralizedNewtypeDeriving, causes GHC to panic. Here is an example:

{-# LANGUAGE StandaloneDeriving #-}

class C a
instance C Int

newtype T = T Int
deriving instance C T

Output:
ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.1 for x86_64-unknown-linux):
	genDerivBinds: bad derived class main:Main.C{tc rdh}
Trac metadata
Trac field Value
Version 6.12.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information