Part of patch in #7403 to improve tag checking in pedantic mode (stephen_dredge)