What grammatical role "long gone" took in above sentences?
I'm not sure but my guess is that long is an adverb. It modifies the adjective gone. Together, these two words form an idiom (an adjective phrase) with the approximate adjectival meaning "that which has passed a long time ago; gone a long time ago".
In the sentence
The ice cream and cake are long gone.
The long gone part is a "subject complement", just as red in
The ball is red.
The same applies to your two other example sentences. A subject complement is used to either describe the subject ("the ice-cream and cake") or to rename it. In your sentences, it is clear that the idiom long gone describes the subjects: it could be called a "predicative adjective". So it's an "adjective", not a "noun" after all.
Your second example sentence might baffle a beginner. It has a changed word order. We can remodel it to the standard order (subject - verb - object):
The days when program verification was a task carried out merely by hand with paper and pen are long gone. (the subject - the copular verb "are" - the predicative adjective "long gone")
The idiom can also be used as an attributive adjective, serving as an attribute and standing before a noun, not after the copula:
"Pops, did you hear the story of long John Dean?"
"Not yet, drummer!"
A bold bank robber from Bowlin' Green
Was sent to the jailhouse yesterday
But late last night he made his getaway
He was long gone from Kentucky
Long gone, ain't he lucky?
Long gone, what I mean
A long gone John from Bowlin' Green (<-- attributive adjective use of long gone; we have the proper noun "John" with the attribute "long gone")
What kind of a John he is? A long-gone John. (we sometimes use the hyphen to make the adjective phrase more readable, turning it into a compound).
It can also be used as a post-positive adjective phrase:
In times long gone, the harvest was a prolonged effort by hand and horse. (Moods of the Ohio Moons: An Outdoorsman's Almanac, 1991)
Here, the adjective phrase long gone modifies the noun times.
You mention a possible noun use. In some expressions with subject complements the predicative expression (the part after the copula) indeed serves a noun role and is called a "predicative nominal":
The ice-cream and cake are delicacies. (are is the copular verb, after it comes the predicative nominal that serves as a "noun" renaming the "ice-cream and cake")
Can long gone be used as a noun ("predicative nominal") in a sentence "X is long gone"? No, unless you intend to baffle the reader, to engage in a word play.
It is sometimes reframed as a noun in other kinds of sentences:
So we've opted out of the system and have decided to let happy long gones be cherished bygones and leave it at that. (Google Books)
Here, we see that long gones are some things that are long gone.