diff --git a/compiler/dbgdwarf.pas b/compiler/dbgdwarf.pas index 232a319ced..b40886a02c 100644 --- a/compiler/dbgdwarf.pas +++ b/compiler/dbgdwarf.pas @@ -2971,7 +2971,11 @@ implementation end; end // Note that the returned 'dwarfoffset' is not used and not a dwarf-offset - else if get_symlist_sym_offset(accesslist.firstsym, membersym, dwarfoffset) then + else if get_symlist_sym_offset(accesslist.firstsym, membersym, dwarfoffset) and + // Debuginfo for static members is not written + // It is not possible to reference something that is not there, so + // omit te reference. + not (sp_static in membersym.symoptions) then begin memberowner := membersym.owner; if (membersym.typ <> fieldvarsym) then diff --git a/tests/test/tdwarfproperties2.pp b/tests/test/tdwarfproperties2.pp new file mode 100644 index 0000000000..4597c26716 --- /dev/null +++ b/tests/test/tdwarfproperties2.pp @@ -0,0 +1,19 @@ +{ %OPT=-gw -godwarfproperties } +program tdwarfproperties2; + +{$mode objfpc}{$H+} + +type + TClassProp=class(TObject) + private + class var FProcessorCount: LongWord; + public + class property ProcessorCount: LongWord read FProcessorCount; + end; + +var + P: TClassProp; + +begin +end. +