There's no universal answer to this question. It depends on where and when the bike has been purchased. I haven't done an extensive search on the topic, but as stated by Weimen Ng in the comment, untransferrable warranties are the norm.
I'm only aware of one exception: Decathlon, in some countries. To take 3 examples:
- Decathlon France and Beligum explicitely indicates that this warranty exists for bikes purchased after 2013, if you can prove you are the legitimate owner - there's even an entry in the FAQ about that
- Decathlon UK limits this warranty to bikes sold by Decathlon and to the original owner of the bike, under the condition that they have registered the bike.
- Decathlon India doesn't indicate if there's a exclusion for second hand bikes. I don't know enough about Indian Consumer Protection laws to know whether this omission is at the benefit of the vendor or the buyer.
Generally speaking, note that there are exclusions that can be used by the manufacturer to refuse a claim (improper use, poor maintenance, bending, denting, use of non-conform parts,...). So up to you to evaluate how these policies are applicable to an old bike that has been used and that has different parts than the original ones.