From d6a150829b04a63bdcc9bafe4fb7faa0e96a9df5 Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Sat, 7 Jan 2017 00:48:55 +0000 Subject: PR23135: Don't instantiate constexpr functions referenced in unevaluated operands where possible. This implements something like the current direction of DR1581: we use a narrow syntactic check to determine the set of places where a constant expression could be evaluated, and only instantiate a constexpr function or variable if it's referenced in one of those contexts, or is odr-used. It's not yet clear whether this is the right set of syntactic locations; we currently consider all contexts within templates that would result in odr-uses after instantiation, and contexts within list-initialization (narrowing conversions take another victim...), as requiring instantiation. We could in principle restrict the former cases more (only const integral / reference variable initializers, and contexts in which a constant expression is required, perhaps). However, this is sufficient to allow us to accept libstdc++ code, which relies on GCC's behavior (which appears to be somewhat similar to this approach). llvm-svn: 291318 --- clang/test/SemaTemplate/default-arguments-cxx0x.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/test/SemaTemplate/default-arguments-cxx0x.cpp') diff --git a/clang/test/SemaTemplate/default-arguments-cxx0x.cpp b/clang/test/SemaTemplate/default-arguments-cxx0x.cpp index c52899a8e6d..d9fa2b4a825 100644 --- a/clang/test/SemaTemplate/default-arguments-cxx0x.cpp +++ b/clang/test/SemaTemplate/default-arguments-cxx0x.cpp @@ -50,6 +50,8 @@ namespace PR16975 { bar(T); }; + bar<> foo{0}; + struct baz : public bar<> { using bar::bar; }; -- cgit v1.2.3