brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · 012868f Raw
37 lines · cpp
1// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncountedCallArgsChecker -verify %s -std=c++2c2// RUN: %clang_analyze_cc1 -analyzer-checker=alpha.webkit.UncheckedLocalVarsChecker -verify %s -std=c++2c3 4// expected-no-diagnostics5 6#include "mock-types.h"7 8class Node {9public:10    Node* nextSibling() const;11 12    void ref() const;13    void deref() const;14};15 16template <class A, class B> struct pair {17  A a;18  B b;19  template <unsigned I> requires ( I == 0 ) A& get();20  template <unsigned I> requires ( I == 1 ) B& get();21};22 23namespace std {24    template <class> struct tuple_size;25    template <unsigned, class> struct tuple_element;26    template <class A, class B> struct tuple_size<::pair<A, B>> { static constexpr int value = 2; };27    template <class A, class B> struct tuple_element<0, ::pair<A, B>> { using type = A; };28    template <class A, class B> struct tuple_element<1, ::pair<A, B>> { using type = B; };29}30 31pair<RefPtr<Node>, RefPtr<Node>> &getPair();32 33static void testUnpackedAssignment() {34    auto [a, b] = getPair();35    a->nextSibling();36}37