https://bugs.llvm.org/show_bug.cgi?id=37556

            Bug ID: 37556
           Summary: Improper symbol redefinition diagnostic for names in
                    different declarative regions
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]

Compiling this well-formed program with -std=c++2a:

    namespace X {
        inline namespace Y { int swap; }

        template<class>
        struct S {
            friend void swap(S&, S&) {}
        };
    }

    int main() {
        X::S<int> s1, s2;
        swap(s1, s2);
    }

produces diagnostics (https://godbolt.org/g/ceWLxY):

    <source>:6:21: error: redefinition of 'swap' as different kind of symbol
            friend void swap(S&, S&) {}
                        ^
    <source>:11:15: note: in instantiation of template class 'X::S<int>'
requested here
        X::S<int> s1, s2;
                ^
    <source>:2:30: note: previous definition is here
        inline namespace Y { int swap; }
                                ^
    1 error generated.

Note that the program compiles successfully if S is replaced by a non-template
class. Discussion on the CWG reflector verified that this program is
well-formed, including Richard's statement "Oops, Clang's redeclaration check
in the template instantiation case is incorrectly performing a redeclaration
lookup as if for a qualified name here, rather than a redeclaration lookup for
an unqualified name."

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to