Use variadic template for Mask constructor [pdfium : main]

0 views
Skip to first unread message

Aryan Krishnan (Gerrit)

unread,
Feb 19, 2026, 12:31:23 PM (3 days ago) Feb 19
to Pdfium LUCI CQ, Lei Zhang, Tom Sepez, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Lei Zhang and Tom Sepez

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Lei Zhang
  • Tom Sepez
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Andy Phan <andy...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Feb 2026 17:31:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Tom Sepez (Gerrit)

unread,
Feb 19, 2026, 12:38:40 PM (3 days ago) Feb 19
to Aryan Krishnan, Pdfium LUCI CQ, Lei Zhang, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Aryan Krishnan and Lei Zhang

Tom Sepez added 1 comment

Patchset-level comments
File-level comment, Patchset 22 (Latest):
Tom Sepez . resolved

We have a kind of test in Chrome called a nocompile test that proves that certain bad forms won't pass the compiler. I was trying to write one for the mismatched enum case here, but we don't have the infrastructure copied over from Chrome to do so. So what I ask is that you try something locally like

enum A { kA1, kA2 };
enum B ( kB1, kB2 };

Mask<A>(kA1, kB2);

and double-check that compilation breaks because of no matching template. Once you've done that, you're good to go.

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Aryan Krishnan
  • Lei Zhang
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Attention: Andy Phan <andy...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Feb 2026 17:38:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
unsatisfied_requirement
open
diffy

Aryan Krishnan (Gerrit)

unread,
Feb 19, 2026, 12:59:47 PM (3 days ago) Feb 19
to Pdfium LUCI CQ, Lei Zhang, Tom Sepez, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Lei Zhang and Tom Sepez

Aryan Krishnan added 1 comment

Patchset-level comments
Tom Sepez . resolved

We have a kind of test in Chrome called a nocompile test that proves that certain bad forms won't pass the compiler. I was trying to write one for the mismatched enum case here, but we don't have the infrastructure copied over from Chrome to do so. So what I ask is that you try something locally like

enum A { kA1, kA2 };
enum B ( kB1, kB2 };

Mask<A>(kA1, kB2);

and double-check that compilation breaks because of no matching template. Once you've done that, you're good to go.

Aryan Krishnan
Yep, tried that out:
```
[0/230] 6.44s F CXX obj/fpdfsdk/pwl/pwl/cpwl_combo_box.o
...
stderr:
In file included from ../../fpdfsdk/pwl/cpwl_combo_box.cpp:7:
In file included from ../../fpdfsdk/pwl/cpwl_combo_box.h:13:
In file included from ../../fpdfsdk/pwl/cpwl_wnd.h:14:
../../core/fxcrt/mask.h:85:12: error: expected ')'
85 | Mask<A>(kA1, kB2);
| ^
../../core/fxcrt/mask.h:85:8: note: to match this '('
85 | Mask<A>(kA1, kB2);
| ^
../../core/fxcrt/mask.h:85:9: error: redefinition of 'kA1' as different kind of symbol
85 | Mask<A>(kA1, kB2);
| ^
../../core/fxcrt/mask.h:82:10: note: previous definition is here
82 | enum A { kA1, kA2 };
| ^
2 errors generated.
```

Seems to work.

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Lei Zhang
  • Tom Sepez
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Andy Phan <andy...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Feb 2026 17:59:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Sepez <tse...@chromium.org>
unsatisfied_requirement
open
diffy

Aryan Krishnan (Gerrit)

unread,
Feb 19, 2026, 1:00:12 PM (3 days ago) Feb 19
to Pdfium LUCI CQ, Lei Zhang, Tom Sepez, Andy Phan, pdfium-...@googlegroups.com
Patchset-level comments
Aryan Krishnan

By work I mean, the test passes, the compile fails as expected.

Gerrit-Comment-Date: Thu, 19 Feb 2026 18:00:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Sepez <tse...@chromium.org>
Comment-In-Reply-To: Aryan Krishnan <aryankr...@gmail.com>
unsatisfied_requirement
open
diffy

Tom Sepez (Gerrit)

unread,
Feb 19, 2026, 1:11:05 PM (3 days ago) Feb 19
to Aryan Krishnan, Pdfium LUCI CQ, Lei Zhang, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Aryan Krishnan and Lei Zhang

Tom Sepez added 1 comment

Patchset-level comments
Tom Sepez

Unfortunately, that's not quite the error I'd expect - can you give me the source?

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Aryan Krishnan
  • Lei Zhang
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Attention: Andy Phan <andy...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Feb 2026 18:11:02 +0000
unsatisfied_requirement
open
diffy

Aryan Krishnan (Gerrit)

unread,
Feb 19, 2026, 1:39:31 PM (3 days ago) Feb 19
to Pdfium LUCI CQ, Lei Zhang, Tom Sepez, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Lei Zhang and Tom Sepez

Aryan Krishnan added 1 comment

Patchset-level comments
Aryan Krishnan
```
template <std::same_as<E>... Args>
constexpr Mask(E first, Args... rest)
: val_((static_cast<UnderlyingType>(first) | ... |
static_cast<UnderlyingType>(rest))) {}
```

This is the code I am currently using.

The test itself is later in the same file. Which I have in there for testing, although i also have a similar test outside in another file that imports it, to test if that is causing anything.

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Lei Zhang
  • Tom Sepez
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Andy Phan <andy...@chromium.org>
Gerrit-Comment-Date: Thu, 19 Feb 2026 18:39:25 +0000
unsatisfied_requirement
open
diffy

Tom Sepez (Gerrit)

unread,
Feb 19, 2026, 2:19:47 PM (3 days ago) Feb 19
to Aryan Krishnan, Pdfium LUCI CQ, Lei Zhang, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Aryan Krishnan and Lei Zhang

Tom Sepez added 1 comment

Patchset-level comments
Tom Sepez

Yeah, that's the code. But I didn't see the test itself uploaded (not that it would compile, but you're getting a basic syntax error as opposed to a template deduction failure, so I'd need to look at the test.. Am I missing something?

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Aryan Krishnan
  • Lei Zhang
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Aryan Krishnan <aryankr...@gmail.com>
unsatisfied_requirement
open
diffy

Aryan Krishnan (Gerrit)

unread,
Feb 19, 2026, 11:37:59 PM (3 days ago) Feb 19
to Pdfium LUCI CQ, Lei Zhang, Tom Sepez, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Lei Zhang and Tom Sepez

Aryan Krishnan added 1 comment

Patchset-level comments
Aryan Krishnan

Tried debugging it a bit, turns out this works:

```
enum A { kA1, kA2 };
enum B { kB1, kB2 };

auto pleaseDontCompile = Mask<A>(kA1, kB2, kA2);
```

I just left this here for local testing, so excuse the... variable naming.

It now returns:
```
../../core/fxcrt/mask.h:85:26: error: no matching constructor for initialization of 'Mask<A>'
85 | auto pleaseDontCompile = Mask<A>(kA1, kB2, kA2);
| ^ ~~~~~~~~~~~~~
../../core/fxcrt/mask.h:30:13: note: candidate template ignored: constraints not satisfied [with Args = <B, A>]
30 | constexpr Mask(E first, Args... rest)
| ^
../../core/fxcrt/mask.h:29:13: note: because 'std::same_as<B, A>' evaluated to false
29 | template <std::same_as<E>... Args>
| ^
gen/third_party/libc++/src/include/__concepts/same_as.h:29:19: note: because '__same_as_impl<B, A>' evaluated to false
29 | concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
| ^
gen/third_party/libc++/src/include/__concepts/same_as.h:26:26: note: because '_IsSame<B, A>::value' evaluated to false
26 | concept __same_as_impl = _IsSame<_Tp, _Up>::value;
| ^
../../core/fxcrt/mask.h:24:13: note: candidate constructor not viable: requires single argument 'that', but 3 arguments were provided
24 | constexpr Mask(const Mask& that) = default;
| ^ ~~~~~~~~~~~~~~~~
../../core/fxcrt/mask.h:27:13: note: candidate constructor not viable: requires single argument 'val', but 3 arguments were provided
27 | constexpr Mask(E val) : val_(static_cast<UnderlyingType>(val)) {}
| ^ ~~~~~
../../core/fxcrt/mask.h:73:22: note: candidate constructor not viable: requires single argument 'val', but 3 arguments were provided
73 | explicit constexpr Mask(UnderlyingType val) : val_(val) {}
| ^ ~~~~~~~~~~~~~~~~~~
../../core/fxcrt/mask.h:23:13: note: candidate constructor not viable: requires 0 arguments, but 3 were provided
23 | constexpr Mask() = default;
| ^
1 error generated.
```
Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Lei Zhang
  • Tom Sepez
Submit Requirements:
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: pdfium
Gerrit-Branch: main
Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
Gerrit-Change-Number: 143150
Gerrit-PatchSet: 22
Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Lei Zhang <the...@chromium.org>
Gerrit-Attention: Tom Sepez <tse...@chromium.org>
Gerrit-Attention: Andy Phan <andy...@chromium.org>
Gerrit-Comment-Date: Fri, 20 Feb 2026 04:37:55 +0000
unsatisfied_requirement
open
diffy

Tom Sepez (Gerrit)

unread,
Feb 20, 2026, 4:21:39 PM (2 days ago) Feb 20
to Aryan Krishnan, Pdfium LUCI CQ, Lei Zhang, Andy Phan, pdfium-...@googlegroups.com
Attention needed from Andy Phan, Aryan Krishnan and Lei Zhang

Tom Sepez added 1 comment

Patchset-level comments
Tom Sepez . unresolved
Tom Sepez

Yes, that's the error we need to see. But for the sake of completeness, what happened in the two-argument case?

Open in Gerrit

Related details

Attention is currently required from:
  • Andy Phan
  • Aryan Krishnan
  • Lei Zhang
Submit Requirements:
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: pdfium
    Gerrit-Branch: main
    Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
    Gerrit-Change-Number: 143150
    Gerrit-PatchSet: 22
    Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
    Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
    Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
    Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
    Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
    Gerrit-Attention: Lei Zhang <the...@chromium.org>
    Gerrit-Attention: Aryan Krishnan <aryankr...@gmail.com>
    Gerrit-Attention: Andy Phan <andy...@chromium.org>
    Gerrit-Comment-Date: Fri, 20 Feb 2026 21:21:35 +0000
    unsatisfied_requirement
    open
    diffy

    Aryan Krishnan (Gerrit)

    unread,
    Feb 20, 2026, 11:17:29 PM (2 days ago) Feb 20
    to Pdfium LUCI CQ, Lei Zhang, Tom Sepez, Andy Phan, pdfium-...@googlegroups.com
    Attention needed from Andy Phan, Lei Zhang and Tom Sepez

    Aryan Krishnan added 1 comment

    Patchset-level comments
    Tom Sepez . resolved
    Aryan Krishnan
    Yes: works for 2 as well.
    ```
    stderr:
    In file included from ../../xfa/fxfa/parser/cxfa_overflow.cpp:7:
    In file included from ../../xfa/fxfa/parser/cxfa_overflow.h:10:
    In file included from ../../xfa/fxfa/parser/cxfa_node.h:18:
    ../../core/fxcrt/mask.h:86:26: error: no matching constructor for initialization of 'Mask<A>'
    86 | auto pleaseDontCompile = Mask<A>(kA1, kB2);
    | ^ ~~~~~~~~
    ../../core/fxcrt/mask.h:30:13: note: candidate template ignored: constraints not satisfied [with Args = <B>]

    30 | constexpr Mask(E first, Args... rest)
    | ^
    ../../core/fxcrt/mask.h:29:13: note: because 'std::same_as<B, A>' evaluated to false
    29 | template <std::same_as<E>... Args>
    | ^
    gen/third_party/libc++/src/include/__concepts/same_as.h:29:19: note: because '__same_as_impl<B, A>' evaluated to false
    29 | concept same_as = __same_as_impl<_Tp, _Up> && __same_as_impl<_Up, _Tp>;
    | ^
    gen/third_party/libc++/src/include/__concepts/same_as.h:26:26: note: because '_IsSame<B, A>::value' evaluated to false
    26 | concept __same_as_impl = _IsSame<_Tp, _Up>::value;
    | ^
    ../../core/fxcrt/mask.h:24:13: note: candidate constructor not viable: requires single argument 'that', but 2 arguments were provided

    24 | constexpr Mask(const Mask& that) = default;
    | ^ ~~~~~~~~~~~~~~~~
    ../../core/fxcrt/mask.h:27:13: note: candidate constructor not viable: requires single argument 'val', but 2 arguments were provided

    27 | constexpr Mask(E val) : val_(static_cast<UnderlyingType>(val)) {}
    | ^ ~~~~~
    ../../core/fxcrt/mask.h:73:22: note: candidate constructor not viable: requires single argument 'val', but 2 arguments were provided

    73 | explicit constexpr Mask(UnderlyingType val) : val_(val) {}
    | ^ ~~~~~~~~~~~~~~~~~~
    ../../core/fxcrt/mask.h:23:13: note: candidate constructor not viable: requires 0 arguments, but 2 were provided

    23 | constexpr Mask() = default;
    | ^
    1 error generated.
    ```

    with code:

    ```
    enum A { kA1, kA2 };
    enum B { kB1, kB2 };

    auto pleaseDontCompile = Mask<A>(kA1, kB2);
    ```

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Andy Phan
    • Lei Zhang
    • Tom Sepez
    Submit Requirements:
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: pdfium
      Gerrit-Branch: main
      Gerrit-Change-Id: Ic67da34892c943e8041d6ee7bb278201a8aeec24
      Gerrit-Change-Number: 143150
      Gerrit-PatchSet: 22
      Gerrit-Owner: Aryan Krishnan <aryankr...@gmail.com>
      Gerrit-Reviewer: Andy Phan <andy...@chromium.org>
      Gerrit-Reviewer: Aryan Krishnan <aryankr...@gmail.com>
      Gerrit-Reviewer: Lei Zhang <the...@chromium.org>
      Gerrit-Reviewer: Tom Sepez <tse...@chromium.org>
      Gerrit-Attention: Lei Zhang <the...@chromium.org>
      Gerrit-Attention: Tom Sepez <tse...@chromium.org>
      Gerrit-Attention: Andy Phan <andy...@chromium.org>
      Gerrit-Comment-Date: Sat, 21 Feb 2026 04:17:23 +0000
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages