From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13198 invoked by alias); 26 Apr 2011 14:40:29 -0000 Received: (qmail 13188 invoked by uid 22791); 26 Apr 2011 14:40:28 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 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; Tue, 26 Apr 2011 14:40:15 +0000 From: "paolo.carlini at oracle dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/48771] [C++0x] is_literal_type incorrect for references to non-literal types 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: paolo.carlini at oracle dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: CC 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 Date: Tue, 26 Apr 2011 14:40:00 -0000 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: 2011-04/txt/msg02636.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48771 Paolo Carlini changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |paolo.carlini at oracle dot | |com --- Comment #2 from Paolo Carlini 2011-04-26 14:39:36 UTC --- The below patchlet fixes the problem and passes the testsuite. Jason, let me know if you consider it safe, for 4_6-branch too, in case. Paolo. ////////////// Index: testsuite/g++.dg/ext/is_literal_type1.C =================================================================== --- testsuite/g++.dg/ext/is_literal_type1.C (revision 0) +++ testsuite/g++.dg/ext/is_literal_type1.C (revision 0) @@ -0,0 +1,11 @@ +// PR c++/48771 +// { dg-do compile } +// { dg-options "-std=c++0x" } + +struct NonLiteral { + NonLiteral(); + ~NonLiteral(); +}; + +static_assert(__is_literal_type(NonLiteral&), "Error"); +static_assert(__is_literal_type(NonLiteral&&), "Error"); Index: cp/semantics.c =================================================================== --- cp/semantics.c (revision 172961) +++ cp/semantics.c (working copy) @@ -5331,7 +5331,8 @@ float_const_decimal64_p (void) bool literal_type_p (tree t) { - if (SCALAR_TYPE_P (t)) + if (SCALAR_TYPE_P (t) + || TREE_CODE (t) == REFERENCE_TYPE) return true; if (CLASS_TYPE_P (t)) return CLASSTYPE_LITERAL_P (t);