[llvm-bugs] [Bug 36684] New: default member initializer for 'm' needed within definition of enclosing class for default argument of function

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Mar 11 04:42:28 PDT 2018


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

            Bug ID: 36684
           Summary: default member initializer for 'm' needed within
                    definition of enclosing class for default argument of
                    function
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jvapen at gmail.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 20047
  --> https://bugs.llvm.org/attachment.cgi?id=20047&action=edit
Complete Reproduction

Following code compiles with MSVC 2015 and not with Clang-Cl:

run.bat
=======
cl.exe /EHsc t.cpp
llvm_6_0_0-RC3\bin\clang-cl.exe -fms-compatibility-version=19 /EHsc t.cpp

t.cpp
=====
#include <limits>
class A
{
   public:
      class B
      {
         public:
            explicit B() = default;
            ~B() = default;

         private:
            double m = std::numeric_limits<double>::max();
      };

   void f(double d, const B &b = B{}) {}
};

int main()
{
   A a{};
   a.f(0.);
}


error
=====
t.cpp(15,34):  error: default member initializer for 'm' needed within
definition of enclosing class 'A' outside of member functions
   void f(double d, const B &b = B{}) {}
                                 ^
t.cpp(12,20):  note: default member initializer declared here
            double m = std::numeric_limits<double>::max();
                   ^
1 error generated.

-- 
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/20180311/869126b9/attachment-0001.html>


More information about the llvm-bugs mailing list