IBM Support

LI74305: NAMESPACE NAME LOOKUP ERROR

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following test case is valid, but the xlC compiler
    generates
    error message about name lookup for "foo" did not find a
    declaration.
    
    
    ======= TEST CASE ======
    test.cpp
    
    -------------------------------------
    namespace mynamespace
    {
    } // close namespace mynamespace
    
    using namespace mynamespace;
    
    namespace mynamespace
    {
      namespace
      {
        void foo() {}   // Line 11
      }
    } // close namespace mynamespace
    
    int main(void) {
        ::foo(); // works
        foo();   // should work but doesn't // Line 19
    }
    --------------------------------
    
    xlC -c test.cpp
    "test.cpp", line 19.5: 1540-0274 (S) The name lookup for "foo"
    did
    not find a declaration.
    "test.cpp", line 11.10: 1540-1298 (I) "void foo()" needs to be
    declared in the containing scope to be found by name lookup.
    

Local fix

  • As a workaround, we suggest naming the unnamed namespace and
    adding a
    using directive:
    
    namespace mynamespace
    {
    }
    
    using namespace mynamespace;
    
    namespace mynamespace
    {
      namespace A
      {
        void foo() {}
      }
      using namespace A;
    }
    

Problem summary

  • USER AFFECTED:
         Affects codes with an unnamed namespace in a namespace,
         which has a previously specified using directive
    
    PROBLEMDESCRIPTION:
         Namelookup through the using directive will not see
         declarations in the nested unnamed namespace.
    

Problem conclusion

  • This namelookup defect has been corrected.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI74305

  • Reported component name

    XL C/C++ SLES10

  • Reported component ID

    5724U8300

  • Reported release

    A10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2009-03-31

  • Closed date

    2009-03-31

  • Last modified date

    2009-03-31

  • APAR is sysrouted FROM one or more of the following:

    IZ36662

  • APAR is sysrouted TO one or more of the following:

    LI74384

Fix information

  • Fixed component name

    XL C/C++ SLES10

  • Fixed component ID

    5724U8300

Applicable component levels

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"A.1","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
16 October 2021