https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120529

            Bug ID: 120529
           Summary: __reference_{converts,constructs}_from_temporary
                    ignore access control
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid, rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: de34 at live dot cn
  Target Milestone: ---

Currently, GCC accepts the following code snippet
(https://godbolt.org/z/sdesq8s5K). But it should be rejected, because the
conversion function is not public, which makes the corresponding reference
binding fail.

```
class Dst {}; 

class Src {
private:
    operator Dst() const;
};

static_assert(__reference_converts_from_temporary(Dst&&, Src));
static_assert(__reference_constructs_from_temporary(Dst&&, Src));
```

Reply via email to