[LLVMbugs] [Bug 17509] New: a call matches incorrect a template function

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Oct 8 03:03:37 PDT 2013


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

            Bug ID: 17509
           Summary: a call matches incorrect a template function
           Product: clang
           Version: unspecified
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eukarpov at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

clang-500.2.75


//============================================================================
// Name        : template.h

template<typename T>
long Print(const T& v) {
    return sizeof(T);
}


//============================================================================
// Name        : sizeofbug.cpp

#include "template.h"

#include <stdio.h>

struct Test {
    bool value;
};

void TestFunc();

int main() {
    fprintf(stderr, "main.cpp: Test: %d   %ld\n", sizeof(Test), Print(Test()));
    TestFunc();
    return 0;
}


//============================================================================
// Name        : source.cpp

#include "template.h"
#include <stdio.h>

struct Test {
    bool value;
    bool value2;
};


void TestFunc() {
    fprintf(stderr, "source.cpp: Test: %d %ld\n", sizeof(Test), Print(Test()));
}

Output:

main.cpp: Test: 1   1
source.cpp: Test: 2 1

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131008/4f84e51b/attachment.html>


More information about the llvm-bugs mailing list