This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Treat mixed enums as error

Is there any way to have the compiler treat mixed enums as errors?  For example, I do not want the code below to be compiled.

enum foo {
	a,
	b,
	c
};

enum bar {
	d,
	e,
	f
};

int main(void) {
    WDTCTL = WDTPW | WDTHOLD;	// Stop watchdog timer
	
    enum foo zot = a;

    enum bar zaz = d;

    zaz = a;

	return 0;
}