Index: test/SemaCXX/attr-cxx0x.cpp
===================================================================
--- test/SemaCXX/attr-cxx0x.cpp	(revision 166419)
+++ test/SemaCXX/attr-cxx0x.cpp	(working copy)
@@ -30,3 +30,9 @@
 // static_assert(alignof(align_class_temp_pack_type<short, int, long>) == alignof(long), "template's alignment is wrong");
 // static_assert(alignof(align_class_temp_pack_expr<8, 16, 32>) == 32, "template's alignment is wrong");
 static_assert(alignof(align_alias_template<int>) == 8, "alias template's alignment is wrong");
+
+[[carries_dependency]] float correct(int x [[carries_dependency]]);
+float also_correct(int x [[carries_dependency]]) [[carries_dependency]];
+float wrong_on_parameter(int [[carries_dependency]] x); // expected-warning {{attribute 'carries_dependency' cannot be specified on type 'int'}}
+float [[carries_dependency]] wrong_on_return(int x); // expected-warning {{attribute 'carries_dependency' cannot be specified on type 'float'}}
+int [[carries_dependency]] wrong_on_both(int [[carries_dependency]] x); // expected-warning 2{{attribute 'carries_dependency' cannot be specified on type 'int'}}
Index: include/clang/Basic/DiagnosticSemaKinds.td
===================================================================
--- include/clang/Basic/DiagnosticSemaKinds.td	(revision 166419)
+++ include/clang/Basic/DiagnosticSemaKinds.td	(working copy)
@@ -1728,6 +1728,9 @@
 def warn_attribute_invalid_on_stmt : Warning<
   "attribute %0 cannot be specified on a statement">,
   InGroup<IgnoredAttributes>;
+def warn_attribute_invalid_on_type : Warning<
+  "attribute %0 cannot be specified on type %1">,
+  InGroup<IgnoredAttributes>;
 def warn_declspec_attribute_ignored : Warning<
   "attribute %0 is ignored, place it after "
   "\"%select{class|struct|union|interface|enum}1\" to apply attribute to "
Index: lib/Sema/SemaDeclAttr.cpp
===================================================================
--- lib/Sema/SemaDeclAttr.cpp	(revision 166419)
+++ lib/Sema/SemaDeclAttr.cpp	(working copy)
@@ -4244,18 +4244,12 @@
 static void ProcessInheritableDeclAttr(Sema &S, Scope *scope, Decl *D,
                                        const AttributeList &Attr) {
   switch (Attr.getKind()) {
-    case AttributeList::AT_IBAction:          handleIBAction(S, D, Attr); break;
-    case AttributeList::AT_IBOutlet:          handleIBOutlet(S, D, Attr); break;
-    case AttributeList::AT_IBOutletCollection:
-      handleIBOutletCollection(S, D, Attr); break;
-  case AttributeList::AT_AddressSpace:
-  case AttributeList::AT_OpenCLImageAccess:
+  case AttributeList::AT_IBAction:          handleIBAction(S, D, Attr); break;
+  case AttributeList::AT_IBOutlet:          handleIBOutlet(S, D, Attr); break;
+  case AttributeList::AT_IBOutletCollection:
+    handleIBOutletCollection(S, D, Attr); break;
   case AttributeList::AT_ObjCGC:
-  case AttributeList::AT_VectorSize:
-  case AttributeList::AT_NeonVectorType:
-  case AttributeList::AT_NeonPolyVectorType:
-    // Ignore these, these are type attributes, handled by
-    // ProcessTypeAttributes.
+    // Ignore, handled in SemaType
     break;
   case AttributeList::AT_CUDADevice:
   case AttributeList::AT_CUDAHost:
@@ -4498,12 +4492,16 @@
     break;
 
   default:
-    // Ask target about the attribute.
-    const TargetAttributesSema &TargetAttrs = S.getTargetAttributesSema();
-    if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S))
-      S.Diag(Attr.getLoc(), Attr.isDeclspecAttribute() ? 
-             diag::warn_unhandled_ms_attribute_ignored : 
-             diag::warn_unknown_attribute_ignored) << Attr.getName();
+    // Type attributes are handled in SemaType.cpp
+    if (!Attr.isUsedAsTypeAttr()) {
+      // Ask target about the attribute.
+      const TargetAttributesSema &TargetAttrs = S.getTargetAttributesSema();
+      if (!TargetAttrs.ProcessDeclAttribute(scope, D, Attr, S))
+        S.Diag(Attr.getLoc(), Attr.isDeclspecAttribute() ? 
+               diag::warn_unhandled_ms_attribute_ignored : 
+               diag::warn_unknown_attribute_ignored) << Attr.getName();
+    }
+
     break;
   }
 }
Index: lib/Sema/SemaType.cpp
===================================================================
--- lib/Sema/SemaType.cpp	(revision 166419)
+++ lib/Sema/SemaType.cpp	(working copy)
@@ -271,7 +271,8 @@
 
 static void processTypeAttrs(TypeProcessingState &state,
                              QualType &type, bool isDeclSpec,
-                             AttributeList *attrs);
+                             AttributeList *attrs,
+                             SourceLocation declSpecLoc = SourceLocation());
 
 static bool handleFunctionTypeAttr(TypeProcessingState &state,
                                    AttributeList &attr,
@@ -936,7 +937,7 @@
   // list of type attributes to be temporarily saved while the type
   // attributes are pushed around.
   if (AttributeList *attrs = DS.getAttributes().getList())
-    processTypeAttrs(state, Result, true, attrs);
+    processTypeAttrs(state, Result, true, attrs, DS.getLocStart());
 
   // Apply const/volatile/restrict qualifiers to T.
   if (unsigned TypeQuals = DS.getTypeQualifiers()) {
@@ -1832,7 +1833,7 @@
     // "void" instead.
     T = SemaRef.Context.VoidTy;
     if (AttributeList *attrs = D.getDeclSpec().getAttributes().getList())
-      processTypeAttrs(state, T, true, attrs);
+      processTypeAttrs(state, T, true, attrs, D.getDeclSpec().getLocStart());
     break;
 
   case UnqualifiedId::IK_ConversionFunctionId:
@@ -4126,12 +4127,14 @@
 }
 
 static void processTypeAttrs(TypeProcessingState &state, QualType &type,
-                             bool isDeclSpec, AttributeList *attrs) {
+                             bool isDeclSpec, AttributeList *attrs, 
+                             SourceLocation declSpecLoc) {
   // Scan through and apply attributes to this type where it makes sense.  Some
-  // attributes (such as __address_space__, __vector_size__, etc) apply to the
-  // type, but others can be present in the type specifiers even though they
-  // apply to the decl.  Here we apply type attributes and ignore the rest.
-
+  // GNU attributes (such as __address_space__, __vector_size__, etc) apply to
+  // the type, but others can be present in the type specifiers even though they
+  // apply to the decl.  Here we apply GNU type attributes and ignore the rest.
+  // C++11 attributes present after type specifier always apply to the type not
+  // the decl ([decl.spec] 7.1)
   AttributeList *next;
   do {
     AttributeList &attr = *attrs;
@@ -4144,8 +4147,22 @@
     // If this is an attribute we can handle, do so now,
     // otherwise, add it to the FnAttrs list for rechaining.
     switch (attr.getKind()) {
-    default: break;
-
+    default:
+      // warn on unknown c++11 attributes that can't be applied to types
+      if (isDeclSpec && attr.isCXX0XAttribute()) {
+        attr.setUsedAsTypeAttr();
+        state.getSema().Diag(attr.getLoc(), 
+                             diag::warn_unknown_attribute_ignored)
+          << attr.getName();
+      }
+      break;
+    case AttributeList::AT_CarriesDependency:
+      // carries_dependency can't be applied to types
+      if (isDeclSpec && declSpecLoc.isValid() && declSpecLoc < attr.getLoc())
+        state.getSema().Diag(attr.getLoc(), 
+                             diag::warn_attribute_invalid_on_type)
+          << attr.getName() << type;
+      break;
     case AttributeList::AT_MayAlias:
       // FIXME: This attribute needs to actually be handled, but if we ignore
       // it it breaks large amounts of Linux software.
