Custom warnings or compiler errors?

Is there a way for a library developer to throw warnings or compiler errors to prevent improper implementation of a class?

Wow. That’s the first straightforward question I’ve asked you folks in a while. (-: