--- /dev/null
+
+# Reported in https://rt.cpan.org/Public/Bug/Display.html?id=59572
+
+use strict;
+use warnings;
+
+use Test::More tests => 4;
+#use Test::NoWarnings;
+use Test::Exception;
+
+{
+ package Role1;
+ use Moose::Role;
+
+ # I do nothing!
+}
+{
+ package Role2;
+
+ use Moose::Role;
+ use MooseX::ClassAttribute;
+
+ class_has attr => (
+ is => 'ro', isa => 'HashRef[Str]',
+ lazy => 1,
+ default => sub { {} },
+ traits => ['Hash'],
+ handles => {
+ has_attr => 'exists',
+ },
+ );
+
+ has foo => ( is => 'rw' );
+
+ sub normal_method
+ {
+ Test::More::pass('a regular method from the role is composed');
+ }
+}
+
+{
+ package Foo;
+ use strict; use warnings;
+ use Moose;
+ with 'Role1', 'Role2';
+ 1;
+}
+
+package main;
+local $TODO = 'Class attributes are lost during role composition';
+# this runs, so Role2 did get composed...
+Foo->normal_method;
+ok(Foo->can('foo'), 'Standard attribute applied ok');
+
+# Except the delegated method ended up in the wrong place!
+
+# ..and MX::Class never got applied properly!
+ok(Moose::Util::does_role(Foo->meta, 'MooseX::ClassAttribute::Trait::Class'),
+ 'metaclass gets MX:CA metaclass trait');
+
+# in Moose 1.08/MooseX::ClassAttribute 0.16, this dies with:
+# Can't locate object method "has_attr" via package "Foo"
+lives_ok { Foo->has_attr('key') }
+ 'Delegated method from native attribute trait is properly composed from a role composed in a list of roles';
+