public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96592] New: Tuple element w/ member reference to incomplete template type rejected
@ 2020-08-12 16:15 cuzdav at gmail dot com
  2020-08-14  0:19 ` [Bug c++/96592] " johnilacqua at hotmail dot com
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: cuzdav at gmail dot com @ 2020-08-12 16:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96592
           Summary: Tuple element w/ member reference to incomplete
                    template type rejected
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cuzdav at gmail dot com
  Target Milestone: ---

Created attachment 49049
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49049&action=edit
source as shown in preview, g++10.2 preprocessed code, and the error messages

This code seems a regression introduced in g++ 10.1, is still in 10.2 and
remains in the trunk.  It works on 9.x and as far back as g++ 6, plus all
versions of clang since 6, icc, msvc, etc.

There are many independent changes that can make it work, including: 
  * making SomeQuery constructor a template constructor (on SessionU)
  * changing the reference to a pointer
  * explicitly declaring Session as an incomplete type and not using
    templates


#include <tuple>

template <typename SessionT>
struct SomeQuery {
    SessionT& session_;
    SomeQuery(SessionT& session) : session_(session) {}
};

template <typename SessionT>
struct Handler {
    std::tuple<SomeQuery<SessionT>> queries_;
    Handler(SessionT& session) : queries_(session) {}
};

struct Session {
    Handler<Session> handler_;
    Session() : handler_{*this} {}
};

int main() {
    Session session;
}


It looks like the tuple class is doing some concept checking that isn't quite
working, but I haven't dug deeply enough to determine if it's a library or
underlying compiler issue.

Live example on Compiler Explorer
https://godbolt.org/z/7naPMx

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-04-21 15:34 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-12 16:15 [Bug c++/96592] New: Tuple element w/ member reference to incomplete template type rejected cuzdav at gmail dot com
2020-08-14  0:19 ` [Bug c++/96592] " johnilacqua at hotmail dot com
2020-08-17 21:51 ` [Bug libstdc++/96592] [10/11 Regression] " mpolacek at gcc dot gnu.org
2020-09-03 15:18 ` redi at gcc dot gnu.org
2020-09-03 15:37 ` cvs-commit at gcc dot gnu.org
2020-09-03 15:38 ` [Bug libstdc++/96592] [10 " redi at gcc dot gnu.org
2020-09-03 15:43 ` redi at gcc dot gnu.org
2020-12-17 15:12 ` ppalka at gcc dot gnu.org
2021-03-29 20:04 ` cvs-commit at gcc dot gnu.org
2021-03-30  4:18 ` ppalka at gcc dot gnu.org
2021-04-08 12:02 ` rguenth at gcc dot gnu.org
2021-11-26 17:41 ` redi at gcc dot gnu.org
2021-11-26 17:41 ` redi at gcc dot gnu.org
2021-11-26 23:07 ` cvs-commit at gcc dot gnu.org
2022-04-21 15:34 ` cvs-commit at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).