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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to