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: unassignedclangb...@nondot.org
          Reporter: har...@gigawatt.nl
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to