Exception: Rubycc::Front::ConstantEvaluator::OffsetofError

Inherits:
NotConstant
  • Object
show all
Defined in:
lib/rubycc/front/constant_evaluator.rb

Overview

Raised when a __builtin_offsetof designator cannot name a byte offset: its type is not a struct/union or is incomplete, a step names no such member, a subscript step applies to a non-array member, or the target is a bit-field (which has no addressable byte offset). It is a NotConstant so every context that already reports a non-constant expression catches it too; detail carries the specific wording for a caller (the generator) that can surface it, over NotConstant's generic message.

Instance Attribute Summary collapse

Attributes inherited from NotConstant

#token

Instance Method Summary collapse

Constructor Details

#initialize(token, detail) ⇒ OffsetofError

Returns a new instance of OffsetofError.



64
65
66
67
# File 'lib/rubycc/front/constant_evaluator.rb', line 64

def initialize(token, detail)
  @detail = detail
  super(token)
end

Instance Attribute Details

#detailObject (readonly)

Returns the value of attribute detail.



62
63
64
# File 'lib/rubycc/front/constant_evaluator.rb', line 62

def detail
  @detail
end