From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5374 invoked by alias); 14 Apr 2012 13:16:36 -0000 Received: (qmail 5339 invoked by uid 22791); 14 Apr 2012 13:16:34 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 14 Apr 2012 13:16:20 +0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/52957] Missing suggestions on '=' and '==' confusion Date: Sat, 14 Apr 2012 13:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-04/txt/msg01131.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52957 --- Comment #10 from Jonathan Wakely 2012-04-14 13:16:18 UTC --- (In reply to comment #9) > (In reply to comment #8) > Thanks for sharing this. This broadens my perception of the issues contributors > have with GCC. That said, it should be possible right now to use a C++ wrapper > around tree, and use that in the C++ FE (and require C++ to bootstrap the C++ > FE). What do you think about that? I think that would help me, I don't know about others. This is probably more suitable for the mailing list not bugzilla but it would certainly help me if a tree is a FIELD_DECL then pass in a field_decl wrapper around a tree, if it's a TREE_LIST pass in a tree_list wrapper around a tree. Then functions/accessors that work on a TREE_LIST could be overloaded to work on the wrapper, so you can use the original accessor on the raw tree if you know what you're doing, or the type-safe overload on the wrapper which will only compile if it's a valid operation. But that wouldn't work when a function parameter is a tree that could be either one type or another. That would either require the function to be refactored to take two parameters, or some other way to have a wrapper that could be more than one thing e.g. make the wrapper a template parameterised on by an enum bitmask template struct tree_wrapper { tree t; explicit tree_wrapper(tree t) : t(t) { gcc_checking_assert ( code() & C ); } tree_code code() const { return TREE_CODE (t); } }; typedef tree_wrapper tree_list; typedef tree_wrapper target_expr; typedef tree_wrapper constructor; // etc. void f( tree_list list ); void g( target_expr expr ); void h( tree_wrapper tree ) { if (tree.code() == TREE_LIST) f( tree_list(tree.t) ); else g( target_expr(tree.t) ); } > Well, the wiki is just a minor example, but it is awfully slow, nobody has > administrator login (I can access as Daniel Berlin and ban users, but little > more), and it is a unsupported version with known security issues. Ah yes, I see what you mean now.