https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101078
Bug ID: 101078
Summary: [11/12 Regression] Rejected code since
r12-1272-gf07edb5d7f3e7721
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: marxin at gcc dot gnu.org
CC: jason at gcc dot gnu.org
Target Milestone: ---
I noticed that in ceph package, note the patch was backported to 11 branch:
$ cat HttpClient.ii
namespace system {
struct error_code {};
} // namespace system
int async_initiate_token, operator0_handler2;
struct async_result {
template <typename Initiation, typename RawCompletionToken, typename... Args>
static void initiate(Initiation initiation, RawCompletionToken token,
Args... args) {
initiation(token, args...);
}
};
template <typename, typename, typename Initiation, typename... Args>
void async_initiate(Initiation initiation, Args... args) {
async_result::initiate(initiation, async_initiate_token, args...);
}
using system::error_code;
struct stream_base {
using time_point = struct op_state { bool pending; };
struct pending_guard {
pending_guard(bool);
};
static time_point never();
};
template <class, class = int, class = int>
struct basic_stream : private stream_base {
struct ops;
template <class MutableBufferSequence, typename ReadHandler>
auto async_read_some(MutableBufferSequence const &, ReadHandler &&);
};
struct async_base {
template <class Handler_> async_base(Handler_, int);
};
template <class Protocol, class Executor, class RatePolicy>
struct basic_stream<Protocol, Executor, RatePolicy>::ops {
struct transfer_op : async_base {
pending_guard pg_;
op_state state();
template <class Handler_>
transfer_op(Handler_, basic_stream, int)
: async_base(0, 0), pg_(state().pending) {
(*this)({});
}
void operator()(long) { never(); }
};
struct run_read_op {
template <class ReadHandler, class Buffers>
void operator()(ReadHandler, basic_stream *s, Buffers b) {
transfer_op(0, *s, b);
}
};
};
template <class Protocol, class Executor, class RatePolicy>
template <class MutableBufferSequence, class ReadHandler>
auto basic_stream<Protocol, Executor, RatePolicy>::async_read_some(
MutableBufferSequence const &buffers, ReadHandler &&) {
async_initiate<ReadHandler, void>(typename ops::run_read_op{}, this,
buffers);
}
template <typename Stream, typename Operation, typename Handler> struct io_op {
io_op(Stream, int, Operation, Handler);
void operator()(error_code) { next_layer_.async_read_some(0, this); }
Stream next_layer_;
};
template <typename Stream, typename Operation, typename Handler>
void async_io(Stream next_layer, int core, Operation op, Handler handler) {
io_op(next_layer, core, op, handler)(error_code());
}
struct stream {
void operator0() { async_io(next_layer_, core_, int(), operator0_handler2); }
basic_stream<int> next_layer_;
int core_;
};
$ g++ HttpClient.ii -c -std=c++17
HttpClient.ii: In instantiation of ‘void basic_stream<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::ops::transfer_op::operator()(long int) [with Protocol = int; Executor = int;
RatePolicy = int]’:
HttpClient.ii:41:14: required from ‘basic_stream< <template-parameter-1-1>,
<template-parameter-1-2>, <template-parameter-1-3>
>::ops::transfer_op::transfer_op(Handler_, basic_stream<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3> >,
int) [with Handler_ = int; Protocol = int; Executor = int; RatePolicy = int;
basic_stream< <template-parameter-1-1>, <template-parameter-1-2>,
<template-parameter-1-3> > = basic_stream<int>]’
HttpClient.ii:48:7: required from ‘void basic_stream<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::ops::run_read_op::operator()(ReadHandler, basic_stream<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>*, Buffers) [with ReadHandler = int; Buffers = int; Protocol = int; Executor =
int; RatePolicy = int]’
HttpClient.ii:9:15: required from ‘static void
async_result::initiate(Initiation, RawCompletionToken, Args ...) [with
Initiation = basic_stream<int>::ops::run_read_op; RawCompletionToken = int;
Args = {basic_stream<int, int, int>*, int}]’
HttpClient.ii:14:25: required from ‘void async_initiate(Initiation, Args ...)
[with <template-parameter-1-1> = io_op<basic_stream<int>, int, int>*;
<template-parameter-1-2> = void; Initiation =
basic_stream<int>::ops::run_read_op; Args = {basic_stream<int, int, int>*,
int}]’
HttpClient.ii:56:36: required from ‘auto basic_stream<
<template-parameter-1-1>, <template-parameter-1-2>, <template-parameter-1-3>
>::async_read_some(const MutableBufferSequence&, ReadHandler&&) [with
MutableBufferSequence = int; ReadHandler = io_op<basic_stream<int>, int, int>*;
<template-parameter-1-1> = int; <template-parameter-1-2> = int;
<template-parameter-1-3> = int]’
HttpClient.ii:60:60: required from ‘void io_op<Stream, Operation,
Handler>::operator()(system::error_code) [with Stream = basic_stream<int>;
Operation = int; Handler = int]’
HttpClient.ii:65:39: required from ‘void async_io(Stream, int, Operation,
Handler) [with Stream = basic_stream<int>; Operation = int; Handler = int]’
HttpClient.ii:68:30: required from here
HttpClient.ii:43:34: error: ‘static stream_base::time_point
stream_base::never()’ is inaccessible within this context
43 | void operator()(long) { never(); }
| ~~~~~^~
HttpClient.ii:22:21: note: declared here
22 | static time_point never();
| ^~~~~