Index: lib/Sema/SemaType.cpp =================================================================== --- lib/Sema/SemaType.cpp +++ lib/Sema/SemaType.cpp @@ -3492,13 +3492,15 @@ static void fillAttributedTypeLoc(AttributedTypeLoc TL, const AttributeList *attrs) { - AttributedType::Kind kind = TL.getAttrKind(); + if (!attrs) + return; - assert(attrs && "no type attributes in the expected location!"); + AttributedType::Kind kind = TL.getAttrKind(); AttributeList::Kind parsedKind = getAttrListKind(kind); while (attrs->getKind() != parsedKind) { attrs = attrs->getNext(); - assert(attrs && "no matching attribute in expected location!"); + if (!attrs) + return; } TL.setAttrNameLoc(attrs->getLoc()); Index: test/SemaCXX/cxx11-gnu-attrs.cpp =================================================================== --- test/SemaCXX/cxx11-gnu-attrs.cpp +++ test/SemaCXX/cxx11-gnu-attrs.cpp @@ -8,6 +8,17 @@ // expected-error@-1 {{'unused' attribute cannot be applied to types}} int *[[gnu::unused]] attr_on_ptr; // expected-warning@-1 {{attribute 'unused' ignored, because it cannot be applied to a type}} +[[gnu::fastcall]] void pr17424_1(); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +[[gnu::fastcall]] [[gnu::stdcall]] void pr17424_2(); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +// expected-warning@-2 {{calling convention 'stdcall' ignored for this target}} +[[gnu::fastcall]] __stdcall void pr17424_3(); +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +// expected-warning@-2 {{calling convention '__stdcall' ignored for this target}} +[[gnu::fastcall]] void pr17424_4() [[gnu::stdcall]]; +// expected-warning@-1 {{calling convention 'fastcall' ignored for this target}} +// expected-warning@-2 {{attribute 'stdcall' ignored, because it cannot be applied to a type}} // Valid cases.