<html>
<head>
<base href="https://llvm.org/bugs/" />
</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 --- - enum return value on friend function spacified as from global namespace ignores whitespace"
href="https://llvm.org/bugs/show_bug.cgi?id=28422">28422</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>enum return value on friend function spacified as from global namespace ignores whitespace
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.7
</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>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>gw.fossdev@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>dgregor@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=16687" name="attach_16687" title="test case">attachment 16687</a> <a href="attachment.cgi?id=16687&action=edit" title="test case">[details]</a></span>
test case
Dear all,
I've came across a wired problem when declaring a function as friend when it is
specified to be in the global namespace and has an enum as return value (see
attached test case).
When I compile the example with -std=c++11 I get the error
whitespace_eating.cc:8:20: error: C++ requires a type specifier for all
declarations
friend enu ::wow();
compiling with std=c++03 gives
whitespace_eating.cc:8:14: warning: use of enumeration in a nested name
specifier is a C++11 extension [-Wc++11-extensions]
friend enu ::wow();
^
whitespace_eating.cc:8:20: error: C++ requires a type specifier for all
declarations
friend enu ::wow();
Given these error messages I can only assume that the parser discards the
whitespace between "enu" and "::wow".
Removing the global namespace specifier "::" before "wow" also results in
compilation errors because now the friend declaration of wow() is assumed to
reside in the "fun" namespace (as it should be) - i.e. this is no workaround.
I've seen the same problem with version 3.9.0-svn274438-1 and 3.7.1
(tags/RELEASE_371/final).
I've also reported a similar bug against g++-6 in the Debian bug tracker [1],
but g++ accepts the construct in c++03 mode.
I've also tested this with "enu" being a struct with similar results, i.e. the
white space between the return type and :: is ignored.
If "enu" is replaced by "int" then the code compiles fine.
Any insight is highly appreciated.
Many thanks,
Gert
[1] <a href="https://bugs.debian.org/829604">https://bugs.debian.org/829604</a>
PS: the original code that made me encounter the problem is some third party
project that uses bison to create some of the code and also the enums.</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>