Call to a member function hasAttribute() on bool