[LLVMbugs] [Bug 10086] New: Explicit Template Instantiation without Original Template Definition

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 6 07:51:34 PDT 2011


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: unassignedclangbugs at nondot.org
        ReportedBy: ythrier at hsr.ch
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


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.



More information about the llvm-bugs mailing list