Hiibel v. Sixth Judicial District Court of Nevada, 542 U.S. 177 is relevant to this question. Nevada has a "stop and identify" statute which requires persons who are stopped to disclose their identity. Defendant refused to answer the question, was arrested and convicted, and the conviction was upheld. However, there isn't an open-ended police privilege to ask a person's name, it must be accompanied by a reasonable suspicion that the suspect committed a crime. As the court held,
An identity request has an immediate relation to the Terry stop’s
purpose, rationale, and practical demands, and the threat of criminal
sanction helps ensure that the request does not become a legal
nullity.
The court also held that
Hiibel’s contention that his conviction violates the Fifth Amendment’s
prohibition on self-incrimination fails because disclosure of his name
and identity presented no reasonable danger of incrimination. The
Fifth Amendment prohibits only compelled testimony that is
incriminating, see Brown v. Walker, 161 U. S. 591, 598, and protects only against disclosures that the witness reasonably believes could be used in a criminal prosecution or could lead to other evidence that might be so used
As the court first states,
Asking questions is an essential part of police investigations. In the
ordinary course a police officer is free to ask a person for
identification without implicating the Fourth Amendment.
“[I]nterrogation relating to one’s identity or a request for
identification by the police does not, by itself, constitute a Fourth
Amendment seizure.”
The courts have repeatedly upheld reasonable actions taken to ensure officer safety in the course of a stop or arrest. Although OP question is framed as a 5th Amendment issue, it is fundamentally a 4th Amendment question, namely whether the stop and brief detention is reasonable, given the "mission" of the stop. Being accurately informed of the presence of a deadly weapon is a reasonable safety precaution (the same safety consideration justifies repeatedly-upheld body searches). If the gun is locked in the trunk, the answer "I have a gun locked in the trunk" should suffice to address the safety concerns and then we're back in the realm of ordinary Terry stop brief detentions. The courts have not, as far as I know, ruled on the parallelism between providing your name during a Terry stop and providing officer-safety related information, but it is hard to imagine that the courts would fail to see the analogy.
Focusing on the self-incrimination aspect, as the court reminds us
Suspects who have been granted immunity from prosecution may,
therefore, be compelled to answer; with the threat of prosecution
removed, there can be no reasonable belief that the evidence will be
used against them
That is, the statement that you have a deadly weapon might indeed have a nexus to a criminal conviction (violation of a felon in possession law), but the statutorily compelled response cannot be used to obtain that conviction. It can be used to alert the officers to the presence of a weapon, which poses a potential safety threat.
Incidentally, the law refers to a concealed weapon which is on your person or within your immediate control in a vehicle: a gun in the trunk is not in your immediate control, but a pistol in your cup-holder would be. This describes exactly the contexts where the safety concern is legitimate (and excludes inferring an obligation to confess to trunk weapons, which the statute does not require).
Hypothetically, Hiibel might have been a wanted criminal suspect, and truthfully providing his name would easily result in his arrest and conviction, although his name is not per se evidence of a crime, it just leads to something that leads to proof of a crime. IMO the court has not fully addressed the subtle interaction between Terry stop law and the Fifth Amendment. This article addresses some of the cracks in the court's application of the law, but it focuses on Fourth Amendment issues. The Miranda-like conclusion that would apply to a weapons question at a Terry stop would be that the confession of having a weapon nearby (when one is a felon or minor prohibited from possessing a weapon) is inadmissible in court.