diff --git a/core/modules/user/src/RoleStorage.php b/core/modules/user/src/RoleStorage.php
index a7f7c6a..a88a1d2 100644
--- a/core/modules/user/src/RoleStorage.php
+++ b/core/modules/user/src/RoleStorage.php
@@ -30,4 +30,26 @@ public function isPermissionInRoles($permission, array $rids) {
     return $has_permission;
   }
 
+  /**
+   * {@inheritdoc}
+   */
+  public function resetCache(array $ids = NULL) {
+    parent::resetCache($ids);
+
+    if ($ids === NULL) {
+      // Clear all static cache.
+      drupal_static_reset('user_roles');
+    }
+    elseif ($ids) {
+      // Remove only roles from $ids list.
+      if ($user_roles =& drupal_static('user_roles')) {
+        $user_roles = array_map(function (array $roles) use ($ids) {
+          return array_filter($roles, function (RoleInterface $role) use ($ids) {
+            return !in_array($role->id(), $ids);
+          });
+        }, $user_roles);
+      }
+    }
+  }
+
 }
diff --git a/core/modules/user/src/Tests/UserRoleDeleteTest.php b/core/modules/user/src/Tests/UserRoleDeleteTest.php
index 81396ac..943283f 100644
--- a/core/modules/user/src/Tests/UserRoleDeleteTest.php
+++ b/core/modules/user/src/Tests/UserRoleDeleteTest.php
@@ -7,7 +7,9 @@
 
 namespace Drupal\user\Tests;
 
+use Drupal\Component\Utility\Unicode;
 use Drupal\simpletest\KernelTestBase;
+use Drupal\user\Entity\Role;
 use Drupal\user\Entity\User;
 
 /**
@@ -76,4 +78,28 @@ public function testRoleDeleteUserRoleReferenceDelete() {
 
   }
 
+  /**
+   * Tests user_roles() static cache invalidation on role deletion.
+   *
+   * @see user_roles()
+   */
+  public function testStaticCacheInvalidation() {
+    $role = Role::create([
+      'id' =>  Unicode::strtolower($this->randomMachineName())
+    ]);
+    $role->save();
+
+    // Load all roles using user_role().
+    $roles = user_roles();
+    // The user role $role is in the 'all roles' list.
+    $this->assertTrue(isset($roles[$role->id()]));
+
+    // Delete the role.
+    $role->delete();
+    // Reload all roles.
+    $roles = user_roles();
+    // The user role $role should not be in the list anymore.
+    $this->assertFalse(isset($roles[$role->id()]));
+  }
+
 }
