[LLVMbugs] [Bug 20445] New: Clang doesn't emit ctor call from template instantiations if it needs to perform initializer_list conversion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 24 16:42:49 PDT 2014


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

            Bug ID: 20445
           Summary: Clang doesn't emit ctor call from template
                    instantiations if it needs to perform initializer_list
                    conversion
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vonosmas at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    nlewycky at google.com, richard-llvm at metafoo.co.uk
    Classification: Unclassified

Reproducer:
$ cat tmp/ilistbug/b.cc
#include <stdio.h>
#include <vector>

class MyClass {
 public:
  explicit MyClass(const std::vector<int> &v) {
    printf("MyClass::MyClass()\n");
  }
};

template <int x>
class MyTest {
 public:
  MyTest() {
    auto c = new MyClass({42, 43});
    printf("Created MyClass: %p\n", c);
  }
};

int main() {
  MyTest<42> test;
  return 0;
}
$ ./bin/clang++ -std=c++11 tmp/ilistbug/b.cc && ./a.out
Created MyClass: 0xb65010


Huh? MyClass is created, but its constructor is never called.
For some reason this code works fine if I make "MyTest" non-template class.
I'm pretty sure this is a recent regression, but I haven't bisected it yet.

-- 
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/20140724/5d19f21d/attachment.html>


More information about the llvm-bugs mailing list