compiler: include selected constant types during export processing

The machinery that collects types referenced by expressions that are
part of inlinable function bodies was missing the types of local named
constants in certain cases. This patch updates the
Collect_export_references::expression() hook to look for references to
local named constants and include their types in the exported set.

Fixes golang/go#34577.

Change-Id: Ib80e7526c01edc1a3f2b422d84785ea67767c888
Reviewed-by: Ian Lance Taylor <>
3 files changed