From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12417 invoked by alias); 16 Aug 2014 07:12:56 -0000 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 Received: (qmail 12407 invoked by uid 89); 16 Aug 2014 07:12:55 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail3-relais-sop.national.inria.fr Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Sat, 16 Aug 2014 07:12:53 +0000 Received: from ip-205.net-81-220-140.rev.numericable.fr (HELO laptop-mg.local) ([81.220.140.205]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 16 Aug 2014 09:12:14 +0200 Date: Sat, 16 Aug 2014 07:12:00 -0000 From: Marc Glisse Reply-To: gcc-help@gcc.gnu.org To: Sidney Marshall cc: gcc-help@gcc.gnu.org Subject: Re: C++11 - Parameter pack question In-Reply-To: <201408160114.s7G1EKDO087976@nef2.ens.fr> Message-ID: References: <201408160114.s7G1EKDO087976@nef2.ens.fr> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8BIT X-SW-Source: 2014-08/txt/msg00114.txt.bz2 On Fri, 15 Aug 2014, Sidney Marshall wrote: > The following code compiles and runs correctly but gives a warning: > > ---------------------------------------- > #include > > using namespace std; > > template > T sum(T value) { > return value; > } > > template > auto sum(T value, U ... values) { > return value + sum(values ...); > } > > int main() { > cout << sum(1, 2, 4.6) << endl; > cout << sum(1, "abcde", 2) << endl; > } > -------------------------------------- > > $ g++ -std=c++11 pack.cpp > pack.cpp:11:31: warning: â??sumâ?? function uses â??autoâ?? type specifier > without trailing return type [enabled by default] > auto sum(T value, U ... values) { The warning should probably specify that this is a C++14 feature. You should be compiling with -std=c++1y. -- Marc Glisse