Movatterモバイル変換


[0]ホーム

URL:


This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 118c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2025-10-11


460. Can ausing-declaration name a namespace?

Section:9.10  [namespace.udecl]    Status:CD1    Submitter:John Spicer    Date:12 Feb 2004

[Voted into WP at April 2005 meeting.]

Can a using-declaration be used to import a namespace?

namespace my_namespace{  namespace my_namespace2 {    int function_of_my_name_space(){ return 2;}  }}int main (){  using  ::my_namespace::my_namespace2;  return my_namespace2::function_of_my_name_space();}

Several popular compilers give an error on this, but theredoesn't seem to be anything in 9.10 [namespace.udecl] thatprohibits it. It should be noted that the user can get the sameeffect by using a namespace alias:

  namespace my_namespace2 = ::my_namespace::my_namespace2;

Notes from the March 2004 meeting:

We agree that it should be an error.

Proposed resolution (October, 2004):

Add the following as a new paragraph after 9.10 [namespace.udecl] paragraph 5:

Ausing-declaration shall not name a namespace;



[8]ページ先頭

©2009-2025 Movatter.jp