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

            Bug ID: 36697
           Summary: Unhelpful error message on ambiguity due to inline
                    namespaces during template specialization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: arthur.j.odw...@gmail.com
                CC: llvm-bugs@lists.llvm.org

Bug 10450 is related.

cat >test.cc <<EOF
namespace A {
    inline namespace v1 {
        template<class T> struct traits { using x = void; };
    }
    inline namespace v2 {
        template<class T> struct traits { using x = void; };
    }
}

template<> struct A::traits<int> { using x = int; };
EOF
clang++ -std=c++14 -c test.cc

```
test.cc:10:22: error: explicit specialization of non-template struct 'traits'
template<> struct A::traits<int> { using x = int; };
                     ^     ~~~~~
1 error generated.
```

It would be nicer of Clang to produce a diagnostic specifically highlighting
the ambiguous name lookup of `A::traits` (`A::v1::traits` versus
`A::v2::traits`), rather than claiming that `traits` is a non-template. (There
is no non-template entity `traits` in the test program.)

Ideally the error message would be something like the message you get today for
use (not specialization) of `A::traits`:

```
test.cc:10:23: error: reference to 'traits' is ambiguous
using y = typename A::traits<int>;
                      ^
test.cc:3:34: note: candidate found by name lookup is 'A::v1::traits'
        template<class T> struct traits { using x = void; };
                                 ^
test.cc:6:34: note: candidate found by name lookup is 'A::v2::traits'
        template<class T> struct traits { using x = void; };
                                 ^
```

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

Reply via email to