From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7603 invoked by alias); 12 Jul 2011 20:56:31 -0000 Received: (qmail 7595 invoked by uid 22791); 12 Jul 2011 20:56:31 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jul 2011 20:56:14 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p6CKuELd007721 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 12 Jul 2011 16:56:14 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p6CKuEZx007742; Tue, 12 Jul 2011 16:56:14 -0400 Received: from [0.0.0.0] (ovpn-113-36.phx2.redhat.com [10.3.113.36]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id p6CKuCK1011874; Tue, 12 Jul 2011 16:56:12 -0400 Message-ID: <4E1CB4EB.3070703@redhat.com> Date: Tue, 12 Jul 2011 21:22:00 -0000 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110621 Fedora/3.1.11-1.fc14 Lightning/1.0b2 Thunderbird/3.1.11 MIME-Version: 1.0 To: Ed Smith-Rowland <3dw4rd@verizon.net> CC: gcc-patches@gcc.gnu.org Subject: Re: [C++-0x] User defined literals. References: <4DB59410.4010800@verizon.net> <4E1C8713.5010206@redhat.com> In-Reply-To: <4E1C8713.5010206@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-07/txt/msg00965.txt.bz2 A few more notes: > + if (DECL_NAMESPACE_SCOPE_P (decl)) > + { > + if (!check_literal_operator_args(decl, > + &long_long_unsigned_p, &long_double_p)) > + { > + error ("%qD has illegal argument list", decl); > + return NULL_TREE; > + } > + > + if (CP_DECL_CONTEXT (decl) == global_namespace) > + { > + const char *suffix = UDLIT_OP_SUFFIX (DECL_NAME (decl)); > + if (long_long_unsigned_p) > + { > + if (cpp_interpret_int_suffix (suffix, strlen (suffix))) > + warning (0, "integer suffix shadowed by implementation"); > + } > + else if (long_double_p) > + { > + if (cpp_interpret_float_suffix (suffix, strlen (suffix))) > + warning (0, "floating point suffix" > + " shadowed by implementation"); > + } > + } > + } Doesn't the shadowing apply everywhere, not just at file scope? > + if (cpp_userdef_string_p (tok->type)) > + { > + string_tree = USERDEF_LITERAL_VALUE (tok->u.value); > + tok->type = cpp_userdef_string_remove_type (tok->type); > + curr_tok_is_userdef_p = true; > + } It seems like a mistake to change tok->type without changing the value. Why not just set the 'type' local variable appropriately? > + const char *curr_suffix = IDENTIFIER_POINTER (suffix_id); > + if (have_suffix_p == 0) > + { > + suffix = xstrdup (curr_suffix); > + have_suffix_p = 1; > + } > + else if (have_suffix_p == 1 && strcmp (suffix, curr_suffix) != 0) ... > + USERDEF_LITERAL_SUFFIX_ID (literal) = get_identifier (suffix); Just remember the identifier and compare it with ==. Identifiers are unique. > + /* Lookup the name we got back from the id-expression. */ > + decl = cp_parser_lookup_name (parser, name, Maybe use lookup_function_nonclass? Jason