[llvm-bugs] [Bug 35425] New: Aggregate initialization of arrays with placement new when arguments are perfectly forwarded

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Nov 26 04:47:53 PST 2017


https://bugs.llvm.org/show_bug.cgi?id=35425

            Bug ID: 35425
           Summary: Aggregate initialization of arrays with placement new
                    when arguments are perfectly forwarded
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ki.stfu at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Hello!

I noticed that I can use aggregate initialization with placement new and
char[10] value, but I cannot do that in a template function if char[10] is
perfectly forwarded.
Unfortunately I cannot refer to the standard and say if it is allowed also.

```
#include <iostream>
#include <utility>

template <typename... Args>
char* foo(Args&&... args) {
    static char a[100];
    return new (a) char[100] {std::forward<Args>(args)...};
}

int main()
{
    std::cout << foo("123456789");

    return 0;
}
```

-- 
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/20171126/e517e3b6/attachment.html>


More information about the llvm-bugs mailing list