[genericreferenceelements.hh] Improve deprecation warnings.

Replace deprecation warning when the file is included by warnings per
constructor or per static method.