[LLVMbugs] [Bug 18153] New: Default value for std::map in a class method doesn't compile

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Dec 5 14:14:03 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=18153

            Bug ID: 18153
           Summary: Default value for std::map in a class method doesn't
                    compile
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: QAPlatformExt at barclays.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 11674
  --> http://llvm.org/bugs/attachment.cgi?id=11674&action=edit
Sample code

The following declaration 
  class Foo {
    double bar(const std::map<int, int>& baz = std::map<int,int>());
  };
causes Clang 3.3. to issue a compilation error:
  error: expected ')'
  double bar(const std::map<int, int>& baz = std::map<int,int>());
                                                              ^
  note: to match this '('
  double bar(const std::map<int, int>& baz = std::map<int,int>());
            ^
  error: expected '>'
  double bar(const std::map<int, int>& baz = std::map<int,int>());
                                                         ^
  2 errors generated.
  Compilation failed

See the attached file for more examples.

The same code compiles correctly in Visual Studio 2012 on Windows and with GCC
4.8.1 on Linux.

Note that std::map and std::vector were used as an example only. It seems that
any other one- and two-parameter template leads to the same error.

-- 
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/20131205/234e7203/attachment.html>


More information about the llvm-bugs mailing list