home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 31,594 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to Gary Sanders   
   Re: auto with multiple name declaration   
   01 Nov 11 05:39:13   
   
   7cfc7eb0   
   From: daniel.kruegler@googlemail.com   
      
   On 2011-11-01 12:01, Gary Sanders wrote:   
   > Using Visual Studio 2010, the following snippet successfully compiles.   
   > 	// snippet #1   
   > 	std::vector  v;   
   > 	. . .   
   > 	auto vb=std::begin(v), ve=std::end(v);   
   >   
   > However, the following snippet fails to compile.   
   > 	// snippet #2   
   > 	int a[] = {0,1,2,3,4,5,6,7,8,9};   
   > 	auto ab=std::begin(a), ae=std::end(a);   
   >   
   > It generates the following:   
   > error C3538: in a declarator-list 'auto' must always deduce to the   
   > same type   
   >             could be 'int *'   
   >             or           'int *'   
      
   [..]   
      
   > Intuitively it seems that snippet #2 should compile. Is Visual Studio   
   > behaving correctly?   
      
   Assuming your code did include the required header  before   
   referring to std::begin/std::end for the second example, this must be a   
   compiler bug.   
      
   HTH & Greetings from Bremen,   
      
   Daniel Krügler   
      
      
      
   --   
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca