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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to