Bug #2568: Segmentation fault deleting key named :class via Hash#delete defined via define_method
http://redmine.ruby-lang.org/issues/show/2568

Author: Caio Chassot
Status: Open, Priority: Normal
ruby -v: ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10] 

$ cat bughash.rb 
#!/usr/bin/env ruby1.9

class BugHash < Hash
  define_method(:delete) { |*a| super *a }
end

BugHash.new.delete :class


$ ruby1.9 bughash.rb 
bughash.rb:4: [BUG] Segmentation fault
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-darwin10]

-- control frame ----------
c:0006 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC  :delete
c:0005 p:0011 s:0011 b:0011 l:0022c8 d:000010 LAMBDA bughash.rb:4
c:0004 p:---- s:0008 b:0008 l:000007 d:000007 FINISH
c:0003 p:0039 s:0006 b:0006 l:001a68 d:000c88 EVAL   bughash.rb:7
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:0000 s:0002 b:0002 l:001a68 d:001a68 TOP   
---------------------------
-- Ruby level backtrace information-----------------------------------------
bughash.rb:4:in `delete'
bughash.rb:4:in `block in <class:BugHash>'
bughash.rb:7:in `<main>'

-- C level backtrace information -------------------------------------------

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap


----------------------------------------
http://redmine.ruby-lang.org