Skip to content

Regression caused by #143096 #151271

@tstellar

Description

@tstellar

I've found a regression caused by #143096, it triggers a static_assert in the webkitgtk code base:

repro.ii:19:21: error: static assertion failed due to requirement '!std::is_same_v<WebCore::SVGCircleElement, WebCore::SVGCircleElement>': Element should use fast property path
   19 |       static_assert(!std::is_same_v<OwnerType, SVGCircleElement>,
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
repro.ii:22:40: note: in instantiation of member function 'WebCore::SVGPropertyOwnerRegistry<WebCore::SVGCircleElement>::fastAnimatedPropertyLookup' requested here
   22 |   int synchronize(const int &) const { fastAnimatedPropertyLookup; }
      |                                        ^
repro.ii:25:46: note: in instantiation of member function 'WebCore::SVGPropertyOwnerRegistry<WebCore::SVGCircleElement>::synchronize' requested here
   25 |   SVGPropertyOwnerRegistry<SVGCircleElement> isKnownAttribute;
      |                      

Here is a reduced test case:

namespace std {
template <typename _Tp, typename _Up>
constexpr bool is_same_v = __is_same(_Tp, _Up);
}
namespace WebCore {
struct SVGPropertyRegistry {
  virtual int synchronize(const int &) const;
};
class SVGCircleElement;
template <typename T>
concept HasFastPropertyForAttribute =
    requires(T element, int name) { element.propertyForAttribute(name); };
template <typename OwnerType>
struct SVGPropertyOwnerRegistry : SVGPropertyRegistry {
  static void fastAnimatedPropertyLookup() {
    if constexpr (HasFastPropertyForAttribute<OwnerType>)
      ;
    else
      static_assert(!std::is_same_v<OwnerType, SVGCircleElement>,
                    "Element should use fast property path");
  }
  int synchronize(const int &) const { fastAnimatedPropertyLookup; }
};
void svgAttributeChanged() {
  SVGPropertyOwnerRegistry<SVGCircleElement> isKnownAttribute;
}
class SVGCircleElement {
  friend SVGPropertyOwnerRegistry<SVGCircleElement>;
  void propertyForAttribute(int);
};
} // namespace WebCore

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsregression

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions