]> granicus.if.org Git - clang/commitdiff
Temporary workaround for bug#12457: turn the 'constexpr function never produces
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Apr 2012 18:57:10 +0000 (18:57 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 5 Apr 2012 18:57:10 +0000 (18:57 +0000)
a constant expression' error into a DefaultError ExtWarn, so that it can be
disabled and is suppressed in system headers. libstdc++4.7 contains some such
functions which we currently can't evaluate as constant expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@154115 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp

index a89217c4725394a622f49728347f56d14fba2549..30173fb7baad2d7d2f9c0187f0e13b045ce3b961 100644 (file)
@@ -1371,9 +1371,9 @@ def err_constexpr_vla : Error<
   "%select{function|constructor}1">;
 def err_constexpr_var_declaration : Error<
   "variables cannot be declared in a constexpr %select{function|constructor}0">;
-def err_constexpr_function_never_constant_expr : Error<
-  "constexpr %select{function|constructor}0 never produces "
-  "a constant expression">;
+def err_constexpr_function_never_constant_expr : ExtWarn<
+  "constexpr %select{function|constructor}0 never produces "
+  "constant expression">, InGroup<DiagGroup<"invalid-constexpr">>, DefaultError;
 def err_constexpr_body_no_return : Error<
   "no return statement in constexpr function">;
 def err_constexpr_body_multiple_return : Error<
index 133d944706d6926cfb103c22b7c50fd20140fd8b..fd17d35677dcc1283c6915a229482da2631c2327 100644 (file)
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -fcxx-exceptions %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -fcxx-exceptions -Wno-invalid-constexpr %s
 
 namespace StdExample {