[LLVMbugs] [Bug 23135] New: [C++11/14] Body of constexpr function templates instantiated too eagerly in unevaluated operands

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Apr 6 10:33:57 PDT 2015


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

            Bug ID: 23135
           Summary: [C++11/14] Body of constexpr function templates
                    instantiated too eagerly in unevaluated operands
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Keywords: compile-fail
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu,
                    richard-llvm at metafoo.co.uk
    Classification: Unclassified

GCC has the same bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52269

~Quoting that bug report:

Ai Azuma wrote:

The following well-formed code cannot be compiled with clang-trunk and the
-std=c++11 (and -std=c++14) flags. 

template<typename T>
int f(T x)
{
    return x.get();
}

template<typename T>
constexpr int g(T x)
{
    return x.get();
}

int main() {

  // O.K. The body of `f' is not required.
  decltype(f(0)) a;

  // Seems to instantiate the body of `g'
  // and results in an error.
  decltype(g(0)) b;

  return 0;
}

-- 
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/20150406/b9a68560/attachment.html>


More information about the llvm-bugs mailing list