diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-09 05:55:43 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-09 05:55:43 +0000 |
commit | afee0ff915b87f92e8c07c72d31c3165aacf6fa8 (patch) | |
tree | 2fed8ddc743f0cd0d4e38687a14033531b4c3438 /test/CXX | |
parent | 569cdc82c1a99fe1e950a1ddbe5ff82df0b13f3d (diff) | |
download | clang-afee0ff915b87f92e8c07c72d31c3165aacf6fa8.tar.gz |
PR14550: If a system header contains a bogus constexpr function definition,
don't mark the function as invalid, since we suppress the error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169689 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
-rw-r--r-- | test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp index 3c1152c631..bca73ee85f 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -verify -std=c++11 -fcxx-exceptions %s -// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-unknown-unknown -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s -DNO_INVALID_CONSTEXPR namespace StdExample { @@ -110,3 +110,23 @@ int y1 = Y<int>().get(); // ok int y2 = Y<Z>().get(); // ok } + +#ifndef NO_INVALID_CONSTEXPR +namespace PR14550 { + // As an "extension", we allow functions which can't produce constant + // expressions to be declared constexpr in system headers (libstdc++ + // marks some functions as constexpr which use builtins which we don't + // support constant folding). Ensure that we don't mark those functions + // as invalid after suppressing the diagnostic. +# 122 "p5.cpp" 1 3 + int n; + struct A { + static constexpr int f() { return n; } + }; + template<typename T> struct B { + B() { g(T::f()); } // expected-error {{undeclared identifier 'g'}} + }; +# 130 "p5.cpp" 2 + template class B<A>; // expected-note {{here}} +} +#endif |