Skip to content

Truly independent web browser

857 B
Raw Blame
/*
 * Copyright (c) 2024, Matthew Olsson <[email protected]>
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

// RUN: %clang++ -Xclang -verify %plugin_opts% -c %s -o %t 2>&1

#include <LibJS/Heap/Cell.h>

class TestClass : JS::Cell {
    GC_CELL(TestClass, JS::Cell);

    struct NestedClassOk : JS::Cell {
        GC_CELL(NestedClassOk, JS::Cell);
    };

    // expected-error@+1 {{Expected record to have a GC_CELL macro invocation}}
    struct NestedClassBad : JS::Cell {
    };

    struct NestedClassNonCell {
    };
};

// Same test, but the parent object is not a cell
class TestClass2 {
    struct NestedClassOk : JS::Cell {
        GC_CELL(NestedClassOk, JS::Cell);
    };

    // expected-error@+1 {{Expected record to have a GC_CELL macro invocation}}
    struct NestedClassBad : JS::Cell {
    };

    struct NestedClassNonCell {
    };
};