[LLVMbugs] [Bug 17560] New: Inline namespaces are not considered when declaring a variable using qualified name

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Oct 12 16:32:02 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=17560

            Bug ID: 17560
           Summary: Inline namespaces are not considered when declaring a
                    variable using qualified name
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: tuomas.tynkkynen at iki.fi
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11364
  --> http://llvm.org/bugs/attachment.cgi?id=11364&action=edit
The failing testcase

The following program is rejected by latest trunk clang:

namespace A {
    inline namespace B {
        extern int t;
    }
}
int A::t;

Compiler output:
tmtynkky at e42-7:~/cppgm$ clang++ -xc++ -std=c++11 -pedantic -c -o /dev/null
definition-via-inline-namespace.cpp

definition-via-inline-namespace.cpp:7:8: error: no member named 't' in
namespace 'A'
int A::t;
    ~~~^
1 error generated.

According to 3.4.3.2p7 of the spec, the member A::B::t should be found with the
name A::t via inline namespace lookup:

"In a declaration for a namespace member in which the declarator-id is a
qualified-id, given that the qualified-id for the namespace member has the form
``nested-name-specifier unqualified-id'', the unqualified-id shall name a
member of the namespace designated by the nested-name-specifier or of an
element of the inline namespace set (7.3.1) of that namespace."

GCC trunk accepts this code (likely by accident, since it has similar bugs in
cases like this)

Version info:
clang version 3.4 (trunk 186244)
Target: x86_64-unknown-linux-gnu

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131012/362138e2/attachment.html>


More information about the llvm-bugs mailing list