Index: lib/Sema/SemaDecl.cpp =================================================================== --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -3568,7 +3568,8 @@ return; // A well-formed anonymous tag must always be a TUK_Definition. - assert(TagFromDeclSpec->isThisDeclarationADefinition()); + if (!TagFromDeclSpec->isThisDeclarationADefinition()) + return; // The type must match the tag exactly; no qualifiers allowed. if (!Context.hasSameType(NewTD->getUnderlyingType(), Index: test/Sema/enum.c =================================================================== --- test/Sema/enum.c +++ test/Sema/enum.c @@ -119,3 +119,7 @@ typedef enum { NegativeShort = (short)-1 } NegativeShortEnum; int NegativeShortTest[NegativeShort == -1 ? 1 : -1]; + +// PR24610 +enum Color { Red, Green, Blue }; // expected-note{{previous use is here}} +typedef struct Color NewColor; // expected-error {{use of 'Color' with tag type that does not match previous declaration}}