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,473 of 33,346   
   =?ISO-8859-1?Q?Daniel_Kr=FCgler?= to All   
   Re: 3.4.1p11, lookup for a name used as    
   19 Sep 11 14:22:18   
   
   c8927a63   
   From: daniel.kruegler@googlemail.com   
      
   Am 17.09.2011 04:43, schrieb nikkoara:   
   > I read 3.4.1p11 as two sentences:   
   >   
   > During the lookup for a name used as a default argument (8.3.6) in a   
   > function parameter-declaration-clause [...] the function parameter   
   > names are visible and hide the names of entities declared in the   
   > block, class or namespace scopes containing the function declaration.   
   >   
   > During the lookup for a name used [...] in the expression of a mem-   
   > initializer for a constructor (12.6.2), the function parameter names   
   > are visible and hide, etc., etc.   
   >   
   > I miss the significance of the first sentence; how does the hiding of   
   > names of entities declared in the block, class, etc. scope, by the   
   > function parameter names, influence the lookup of the default   
   > argument? Does anybody have an example?   
      
   What about this one:   
      
   int foo(int);   
      
   void bar(int foo = foo(12));   
      
   Here the name 'foo' in the expression 'foo(12)' would resolve to the   
   function parameter name 'foo'. After this has happened, we fall into   
   8.3.6 [dcl.fct.default] p9:   
      
   "[..] Consequently, parameters of a function shall not be used in a   
   default argument, even if they are not evaluated. [..]"   
      
   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