public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96926] New: [9/10/11 Regression] Tuple element w/ member reference to incomplete template type rejected
@ 2020-09-03 16:17 redi at gcc dot gnu.org
  2020-09-03 16:18 ` [Bug c++/96926] " redi at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: redi at gcc dot gnu.org @ 2020-09-03 16:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96926
           Summary: [9/10/11 Regression] Tuple element w/ member reference
                    to incomplete template type rejected
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
                CC: cuzdav at gmail dot com, johnilacqua at hotmail dot com,
                    mpolacek at gcc dot gnu.org, unassigned at gcc dot gnu.org,
                    webrown.cpp at gmail dot com
  Target Milestone: ---

+++ This bug was initially created as a clone of Bug #96592 +++

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


+++ PR 96592 comment 6 +++

As further evidence the compile is confused, the preprocessed source from GCC
10 can be compiled by GCC 8, but not GCC 9, 10 or trunk.

It started to be rejected with r262172 (fixing PR c++/80290), but the problem
was latent until r10-908 made std::tuple vulnerable to it.

I'll start reducing the preprocessed source ...

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

end of thread, other threads:[~2022-05-13 15:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-03 16:17 [Bug c++/96926] New: [9/10/11 Regression] Tuple element w/ member reference to incomplete template type rejected redi at gcc dot gnu.org
2020-09-03 16:18 ` [Bug c++/96926] " redi at gcc dot gnu.org
2020-09-03 16:19 ` redi at gcc dot gnu.org
2020-09-03 18:26 ` redi at gcc dot gnu.org
2020-09-04  6:36 ` rguenth at gcc dot gnu.org
2020-10-12 12:25 ` rguenth at gcc dot gnu.org
2021-02-12  3:24 ` jason at gcc dot gnu.org
2021-02-12  5:00 ` jason at gcc dot gnu.org
2021-02-12  5:09 ` jason at gcc dot gnu.org
2021-02-13  6:12 ` jason at gcc dot gnu.org
2021-02-19  2:22 ` cvs-commit at gcc dot gnu.org
2021-02-19  4:01 ` cvs-commit at gcc dot gnu.org
2021-02-25 16:34 ` [Bug c++/96926] [9/10 " jason at gcc dot gnu.org
2021-06-01  8:18 ` rguenth at gcc dot gnu.org
2022-05-13 15:25 ` jason 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).