[llvm-bugs] [Bug 47682] New: Default arguments on declaration in inline namespace ignored
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Sep 29 10:26:22 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=47682
Bug ID: 47682
Summary: Default arguments on declaration in inline namespace
ignored
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++11
Assignee: unassignedclangbugs at nondot.org
Reporter: harald at gigawatt.nl
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
When a function declared in an inline namespace is defined in an enclosing
namespace without the namespace qualifier, default arguments on the original
declaration are lost.
namespace N {
inline namespace N2 {
void f(int = 0);
}
}
void N::f(int) {}
void g() { N::f(); }
Changing the call to N::f(0) and looking at the generated assembly shows that
clang does treat the definition of f as a definition of N::N2::f.
Changing the definition to explicitly name N2, as in void N::N2::f(int) {},
does preserve the default argument.
GCC, MSVC and Intel all accept the code as is: <https://godbolt.org/z/G1a3q1>.
--
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/20200929/ebfd14e8/attachment.html>
More information about the llvm-bugs
mailing list