From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12259 invoked by alias); 6 Jun 2012 01:15:39 -0000 Received: (qmail 12249 invoked by uid 22791); 6 Jun 2012 01:15:38 -0000 X-SWARE-Spam-Status: No, hits=-3.5 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; Wed, 06 Jun 2012 01:15:17 +0000 From: "yacwroy at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/53585] New: template value parameter of pointer-to-member type incorrectly rejects non-direct values Date: Wed, 06 Jun 2012 01:15:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: yacwroy at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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-06/txt/msg00278.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D53585 Bug #: 53585 Summary: template value parameter of pointer-to-member type incorrectly rejects non-direct values Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: yacwroy@gmail.com Created attachment 27561 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=3D27561 c++ testcase - should be legal Problem: Pointer-to-member value parameters appear to only accept direct values (of = the immediate form &X::Y) and reject passed constexpr variables. llvm/clang++ accepts these. I'm assuming this is legal but I haven't checked the standard. specs: linux/x64 source (same as attached) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D struct SFoo { int x; }; constexpr int SFoo::* G_ptr_to_x =3D &SFoo::x; // Dummy test struct. template struct SBar {}; SBar G_bar; // . (This should be legal, and is in clang). // Additional testing: SBar<&SFoo::x> G_bar2; // Shows the member-pointer works if immediate. constexpr int SFoo::* another_ptr =3D G_ptr_to_x; // Shows "could not conve= rt ..." error message is incorrect. int main() {} =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Errors (build command =3D g++ mptr.cpp -std=3Dc++11). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D test/misc/mptr.cpp:12:16: error: =E2=80=98G_ptr_to_x=E2=80=99 is not a vali= d template argument for type =E2=80=98int SFoo::*=E2=80=99 SBar G_bar; // . (This should be legal, and is in clang= ). ^ test/misc/mptr.cpp:12:16: error: it must be a pointer-to-member of the form =E2=80=98&X::Y=E2=80=99 test/misc/mptr.cpp:12:16: error: could not convert template argument =E2=80=98G_ptr_to_x=E2=80=99 to =E2=80=98int SFoo::*=E2=80=99 test/misc/mptr.cpp:12:23: error: invalid type in declaration before =E2=80= =98;=E2=80=99 token SBar G_bar; // . (This should be legal, and is in clang= ). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D