[LLVMbugs] [Bug 14087] New: Clang rejects new (uniform) initialization of classes with lists inside.

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Oct 15 08:09:18 PDT 2012


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

             Bug #: 14087
           Summary: Clang rejects new (uniform) initialization of classes
                    with lists inside.
           Product: clang
           Version: trunk
          Platform: PC
        OS/Version: MacOS X
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sorlok_reaves at yahoo.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Created attachment 9349
  --> http://llvm.org/bugs/attachment.cgi?id=9349
Simplest-possible test that fails to compile.

The attached code fails to compile on clang, with the following complaint. It
works fine in gcc-4.6:

clang_test.cpp:26:13: error: no matching constructor for initialization of
      'VerboseList'
VerboseList test_item 
            ^
clang_test.cpp:16:7: note: candidate constructor (the implicit copy
constructor)
      not viable: cannot convert initializer list argument to 'const
VerboseList'
class VerboseList {
      ^
clang_test.cpp:20:3: note: candidate constructor not viable: cannot convert
      initializer list argument to 'list<StringParam>'
  VerboseList(list<StringParam> params) : params(params) 
  ^
1 error generated.


I compiled clang from scratch on OSX (since Apple's version is quite out of
date). It's a few weeks old:

clang version 3.2 (trunk 162644)

I am not 100% sure I am using uniform initialization correctly, but I think
this should compile. Like I said, it compiles on gcc 4.6 (although I know clang
is stricter than gcc at times). 

Is this a bug, or is my understanding of uniform initialization lacking?

-- 
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