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

           Summary: Explicit Template Instantiation without Original
                    Template Definition
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


CLANG seems to accept explicit template instantiation without a previous
template definition. The following example is accepted by clang++, but rejected
by g++:

[Example "A.cpp"

template void foobar(int i) {
  // ...
}

int main() {
  foobar(5);
}

end example]

~$clang++ A.cpp // Accept
~$g++ A.cpp // 'foobar' is not a template function

CLANG may threat the function as some kind of "overload", because in the
example, "foobar" is defined with a body statement. After removing the function
body, CLANG rejects the example code. However, the original situation should
not be possible. The example is accepted by g++ if a previous template
definition exists.

Regards

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- 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