diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc
index 3737e5f010c..de53678715e 100644
--- a/gcc/cp/decl2.cc
+++ b/gcc/cp/decl2.cc
@@ -3027,7 +3027,11 @@ constrain_class_visibility (tree type)
 %qT has a field %qD whose type depends on the type %qT which has no linkage",
 			       type, t, nlt);
 		  }
-		else
+		else if (cxx_dialect > cxx98)
+		  warning (OPT_Wsubobject_linkage, "\
+%qT has a field %qD whose type has internal linkage",
+			   type, t);
+		else // In C++98 this can only happen with unnamed namespaces.
 		  warning (OPT_Wsubobject_linkage, "\
 %qT has a field %qD whose type uses the anonymous namespace",
 			   type, t);
@@ -3062,7 +3066,11 @@ constrain_class_visibility (tree type)
 %qT has a base %qT whose type depends on the type %qT which has no linkage",
 			     type, TREE_TYPE (t), nlt);
 		}
-	      else
+	      else if (cxx_dialect > cxx98)
+		warning (OPT_Wsubobject_linkage, "\
+%qT has a base %qT whose type has internal linkage",
+			 type, TREE_TYPE (t));
+	      else // In C++98 this can only happen with unnamed namespaces.
 		warning (OPT_Wsubobject_linkage, "\
 %qT has a base %qT whose type uses the anonymous namespace",
 			 type, TREE_TYPE (t));
diff --git a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C
index 95a04501441..b116fbbb186 100644
--- a/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C
+++ b/gcc/testsuite/g++.dg/warn/Wsubobject-linkage-3.C
@@ -3,7 +3,7 @@
 namespace { struct Foo { }; }
 
 #line 6 "foo.C"
-struct Bar { Foo foo; };   // { dg-warning "anonymous namespace" }
+struct Bar { Foo foo; };   // { dg-warning "anonymous namespace|internal linkage" }
 // { dg-bogus "no linkage" "" { target *-*-* } .-1 }
-struct Bar2 : Foo { };     // { dg-warning "anonymous namespace" }
+struct Bar2 : Foo { };     // { dg-warning "anonymous namespace|internal linkage" }
 // { dg-bogus "no linkage" "" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C b/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C
index cf193e0cba5..eed3818c5cf 100644
--- a/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C
+++ b/gcc/testsuite/g++.dg/warn/anonymous-namespace-1.C
@@ -14,5 +14,9 @@ class foobar1
 };
 
 #line 17 "foo.C"
-class foobar : public bad { }; // { dg-warning "uses the anonymous namespace" }
-class foobar2 { bad b; }; // { dg-warning "uses the anonymous namespace" }
+class foobar : public bad { };
+// { dg-warning "has internal linkage" "" { target c++11 } .-1 }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-2 }
+class foobar2 { bad b; };
+// { dg-warning "has internal linkage" "" { target c++11 } .-1 }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-2 }
diff --git a/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C b/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C
index 4048f3959df..f2ca5915278 100644
--- a/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C
+++ b/gcc/testsuite/g++.dg/warn/anonymous-namespace-2.C
@@ -18,12 +18,15 @@ struct g3 {
 };
 
 #line 21 "foo.C"
-struct b1 { // { dg-warning "uses the anonymous namespace" }
+struct b1 { // { dg-warning "has internal linkage" "" { target c++11 } }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-1 }
     bad * B;
 };
-struct b2 { // { dg-warning "uses the anonymous namespace" }
+struct b2 { // { dg-warning "has internal linkage" "" { target c++11 } }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-1 }
     bad * B[1];
 };
-struct b3 { // { dg-warning "uses the anonymous namespace" }
+struct b3 { // { dg-warning "has internal linkage" "" { target c++11 } }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-1 }
     bad (*B)[1];
 };
diff --git a/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C b/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
index 8b72abdf5d1..ce5745b25f0 100644
--- a/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
+++ b/gcc/testsuite/g++.dg/warn/anonymous-namespace-3.C
@@ -7,7 +7,8 @@
 struct B { std::auto_ptr<A> p; };
 
 #line 10 "foo.C"
-struct C		   // { dg-warning "uses the anonymous namespace" }
+struct C // { dg-warning "has internal linkage" "" { target c++11 } }
+// { dg-warning "uses the anonymous namespace" "" { target c++98_only } .-1 }
 {
   std::auto_ptr<A> p;
 };
