[LLVMbugs] [Bug 8692] New: use of default argument to function that is declared later in class

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Nov 24 19:07:34 PST 2010


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

           Summary: use of default argument to function that is declared
                    later in class
           Product: clang
           Version: 2.8
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: timoskrempel at gmx.de
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com


The following program is valid c++ and generates an error with clang++ but
works fine in g++:

$ cat main.cc
class A
{
  public:
    class B
    {
      public:
    B(int i=1)
      {}
    };

    A(B b = B())
      {}

};

int main()
{
  A a;
}


$ clang++ main.cc
main.cc:11:13: error: use of default argument to function 'B' that is declared
      later in class 'B'
    A(B b = B())
            ^
main.cc:7:10: note: default argument declared here
        B(int i=1)
                ^
1 error generated.

$ clang++ -v
clang version 2.8 (branches/release_28)
Target: x86_64-pc-linux-gnu
Thread model: posix

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list