From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14219 invoked by alias); 14 Nov 2011 20:23:10 -0000 Received: (qmail 14205 invoked by uid 22791); 14 Nov 2011 20:23:08 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-bw0-f47.google.com (HELO mail-bw0-f47.google.com) (209.85.214.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Nov 2011 20:22:55 +0000 Received: by bkbzs2 with SMTP id zs2so7259069bkb.20 for ; Mon, 14 Nov 2011 12:22:53 -0800 (PST) Received: by 10.205.124.144 with SMTP id go16mr13204567bkc.119.1321302173643; Mon, 14 Nov 2011 12:22:53 -0800 (PST) Received: from [10.0.0.29] (nat-pool-c1-b.lf.lv. [91.201.12.9]) by mx.google.com with ESMTPS id h7sm24628357bkw.12.2011.11.14.12.22.51 (version=SSLv3 cipher=OTHER); Mon, 14 Nov 2011 12:22:52 -0800 (PST) Message-ID: <4EC1789A.2070209@gmail.com> Date: Mon, 14 Nov 2011 21:48:00 -0000 From: "vagran.ast" User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.23) Gecko/20110922 Lightning/1.0b2 Thunderbird/3.1.15 MIME-Version: 1.0 To: gcc-help@gcc.gnu.org Subject: Template argument (pointer to member function) initialization with NULL Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-11/txt/msg00132.txt.bz2 Hi, In the following code: class A { public: void SomeMethod() { } }; template class B { }; B b1; // error: could not convert template argument '0' to 'void (A::*)()' B b2; // error: could not convert template argument '0' to 'void (A::*)()' void (A::*someMethod)() = 0; // OK there are two compilation errors. AFAIK per C++ standard 0 is a valid value for a pointer to member function. Variable of such type can be successfully initialized by 0 but template arguments can not. Is it desired behavior or a bug? gcc version 4.6.1