Index: test/Parser/cxx0x-attributes.cpp
===================================================================
--- test/Parser/cxx0x-attributes.cpp	(revision 168049)
+++ test/Parser/cxx0x-attributes.cpp	(working copy)
@@ -230,3 +230,6 @@
 typedef [[gnu::used]] unsigned long [[gnu::unused]] v2; // expected-warning {{attribute 'unused' ignored, because it is not attached to a declaration}} \
           expected-error {{an attribute list cannot appear here}}
 int [[carries_dependency]] foo(int [[carries_dependency]] x); // expected-warning 2{{attribute 'carries_dependency' ignored, because it is not attached to a declaration}}
+
+// parser should not be confused and emit wrong diagnostic if user placed attribute in wrong place
+class [[]] c [[]];
Index: lib/Parse/ParseDeclCXX.cpp
===================================================================
--- lib/Parse/ParseDeclCXX.cpp	(revision 168049)
+++ lib/Parse/ParseDeclCXX.cpp	(working copy)
@@ -1232,6 +1232,8 @@
   //    'struct foo final :' or 'struct foo final {', then this is a definition.
   //  - If we have 'struct foo;', then this is either a forward declaration
   //    or a friend declaration, which have to be treated differently.
+  //    If we have 'struct foo [[]]', then this is still a declaration and we
+  //    let caller diagnose misplaced attribute specifiers.
   //  - Otherwise we have something like 'struct foo xyz', a reference.
   // However, in type-specifier-seq's, things look like declarations but are
   // just references, e.g.
@@ -1240,6 +1242,8 @@
   //   &T::operator struct s;
   // For these, DSC is DSC_type_specifier.
   Sema::TagUseKind TUK;
+  bool MaybeCXX11Attributes = Tok.is(tok::l_square) && 
+    NextToken().is(tok::l_square);
   if (DSC == DSC_trailing)
     TUK = Sema::TUK_Reference;
   else if (Tok.is(tok::l_brace) ||
@@ -1262,9 +1266,11 @@
     }
   } else if (DSC != DSC_type_specifier &&
              (Tok.is(tok::semi) ||
-              (Tok.isAtStartOfLine() && !isValidAfterTypeSpecifier(false)))) {
+               MaybeCXX11Attributes ||
+               (Tok.isAtStartOfLine() && !isValidAfterTypeSpecifier(false)))) {
     TUK = DS.isFriendSpecified() ? Sema::TUK_Friend : Sema::TUK_Declaration;
-    if (Tok.isNot(tok::semi)) {
+    // 
+    if (Tok.isNot(tok::semi) && !MaybeCXX11Attributes) {
       // A semicolon was missing after this declaration. Diagnose and recover.
       ExpectAndConsume(tok::semi, diag::err_expected_semi_after_tagdecl,
         DeclSpec::getSpecifierName(TagType));
