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

            Bug ID: 21422
           Summary: spurious diagnostic produced for second use of
                    ill-formed function template specialization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified

Testcase:

template<typename T> struct A {
  A() { T::error; }
};
struct B : A<int> {};
template<typename T> struct C : A<T> { C() : A<int>() {} };
B b;
C<int> c;

This produces:

<stdin>:2:9: error: type 'int' cannot be used prior to '::' because it has no
members
  A() { T::error; }
        ^
<stdin>:4:8: note: in instantiation of member function 'A<int>::A' requested
here
struct B : A<int> {};
       ^
<stdin>:5:46: error: no matching constructor for initialization of 'A<int>'
template<typename T> struct C : A<T> { C() : A<int>() {} };
                                             ^
<stdin>:6:13: note: in instantiation of member function 'C<int>::C' requested
here
B b; C<int> c;
            ^
<stdin>:1:29: note: candidate constructor (the implicit copy constructor) not
viable: requires 1 argument, but 0 were provided
template<typename T> struct A {
                            ^

The first error is fine; the second one is bogus. Two issues here:

1) we shouldn't be marking the declaration of the function as invalid just
because we failed to instantiate its definition (but currently this is how we
track that we shouldn't try to instantiate it again, so we'll need another
representation for that if we change this), and
2) if the candidate set contains invalid functions, overload resolution should
always succeed (rather than ignoring those functions), since as far as we know
one of those invalid functions could be intended to match.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to