Name appeared in user-declared namespace

46 views
Skip to first unread message

xulibartejioplynt

unread,
May 29, 2014, 1:40:06 AM5/29/14
to std-dis...@isocpp.org
There is a quote from 3.4.1/14:
If a variable member of a namespace is defined outside of the scope of its namespace then any name that
appears in the definition of the member (after the declarator-id) is looked up as if the definition of the
member occurred in its namespace.
Q1: So where is it point of declaration?

But in the 3.4.1/5 said:
A name used in a user-declared namespace outside of the definition of any function or class shall be declared
before its use in that namespace or before its use in a namespace enclosing its namespace.

Consider the following example:

namespace A
{
   
namespace B
   
{
       
extern int j;
       
int i=4;
   
}
}

int i=2;

M
::N::j=i //4

Q2: Does it mean that rule 3.4.1/14 will be applied first and if it fails then rule from 3.4.1/5 will be applied?

ajay kumar

unread,
Oct 4, 2015, 7:14:45 AM10/4/15
to ISO C++ Standard - Discussion, bund...@gmail.com
Reply all
Reply to author
Forward
0 new messages