[LLVMbugs] [Bug 13785] New: using-declarations versus default-arguments, and nested-name-specifiers

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Sep 6 14:17:40 PDT 2012


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

             Bug #: 13785
           Summary: using-declarations versus default-arguments, and
                    nested-name-specifiers
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: richard-llvm at metafoo.co.uk
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Clang rejects this:

  namespace A { int f(int a, int b = 0); }
  using A::f;
  namespace A { int f(int a = 0, int b); }
  int k = f();

... claiming that f requires at least one argument. It accepts this:

  namespace A { int f(int a, int b = 0); }
  using A::f;
  namespace A { int f(int a = 0, int b); }
  using A::f;
  int k = f();

... but then rejects this:

  namespace A { int f(int a, int b = 0); }
  using A::f;
  namespace A { int f(int a = 0, int b); }
  using A::f;
  int k = ::f();

We have the same story with default arguments for function templates. Rejected
(could not deduce 'a'):

  namespace A { template<int a, int b = 0> int f(); }
  using A::f;
  namespace A { template<int a = 0, int b> int f(); }
  int k = f<>();

Accepted:

  namespace A { template<int a, int b = 0> int f(); }
  using A::f;
  namespace A { template<int a = 0, int b> int f(); }
  using A::f;
  int k = f<>();

Rejected:

  namespace A { template<int a, int b = 0> int f(); }
  using A::f;
  namespace A { template<int a = 0, int b> int f(); }
  using A::f;
  int k = ::f<>();

Based on [namespace.udecl]p11, I think the first two results are correct
("Definitions added to the namespace after the using-declaration are not
considered when a use of the name is made.") but the third result in each set
seems to be incorrect.

-- 
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