Here's what the ATF says. Note the word OR. Tacking it isn't enough, but a good weld is.
"The ATF procedure for measuring barrel length is to measure from the closed bolt (or breech-face) to the furthermost end of the barrel or permanently attached muzzle device. Permanent methods of attachment include full-fusion gas or electric steel-seam welding, high-temperature (1100°F) silver soldering, OR blind pinning with the pin head welded over."