<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - Odd "argument deduction not allowed in function return type" when initializing static data member"
href="https://bugs.llvm.org/show_bug.cgi?id=47383">47383</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Odd "argument deduction not allowed in function return type" when initializing static data member
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>stephan.bergmann.secondary@googlemail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>At least with recent Clang 12 trunk and with clang-10.0.0-2.fc32.x86_64:
<span class="quote">> $ cat test.cc
> template<int N> struct S1 { constexpr S1(char const (&)[N]) {} };
> struct S2 { static constexpr S1 s(""); };</span >
<span class="quote">> $ clang++ -std=c++17 -fsyntax-only test.cc
> test.cc:2:35: error: expected parameter declarator
> struct S2 { static constexpr S1 s(""); };
> ^
> test.cc:2:35: error: expected ')'
> test.cc:2:34: note: to match this '('
> struct S2 { static constexpr S1 s(""); };
> ^
> test.cc:2:30: error: use of class template 'S1' requires template arguments; argument deduction not allowed in function return type
> struct S2 { static constexpr S1 s(""); };
> ^~
> test.cc:1:24: note: template is declared here
> template<int N> struct S1 { constexpr S1(char const (&)[N]) {} };
> ^
> 3 errors generated.</span >
Compilation succeeds when replacing the complete second line with either
<span class="quote">> struct S2 { static constexpr S1 s = ""; };</span >
or
<span class="quote">> static constexpr S1 s("");</span ></pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>