[LLVMbugs] [Bug 22971] New: Lookup of non-dependent name performed in Phase 2

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Mar 21 01:23:50 PDT 2015


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

            Bug ID: 22971
           Summary: Lookup of non-dependent name performed in Phase 2
           Product: clang
           Version: 3.6
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: sneves at dei.uc.pt
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Take the following example:

namespace ns1 {
  template<typename T>
  constexpr bool f(T const &) { return true; }
}

namespace ns2 {
  template<typename T> struct S {};
}

template<typename = void>
constexpr int g() {
  using ns1::f;
  return f(ns2::S<int>());
}

namespace ns2 {
  template<template<typename> class T, typename U>
  constexpr bool f(T<U> const &) { return false; }
}

static_assert(g(), "");

In GCC and EDG the static_assert does not fail, i.e., g() calls f(T const&).
Clang, on the other hand, appears to examine g() at the instantiation point,
and calls the better fit f(T<U> const&). 

My understanding of the standard is that, since ns2::S<int> is not a dependent
type, the lookup of f() should be performed in the context of g()'s definition
and not of its instantiation. So I think Clang is wrong here.

-- 
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/20150321/c9ecde36/attachment.html>


More information about the llvm-bugs mailing list