summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2014-06-20 19:23:57 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2014-06-20 19:23:57 +0000
commit46762030114916f9eabb40f7c4024ac3ab9fd7ba (patch)
tree625ea1e5ddeab2e51e56f16f77b885540331d5c3 /clang
parent6baeb8805cd69638ae7c5882826c15a1394a3b79 (diff)
downloadbcm5719-llvm-46762030114916f9eabb40f7c4024ac3ab9fd7ba.tar.gz
bcm5719-llvm-46762030114916f9eabb40f7c4024ac3ab9fd7ba.zip
[C++1z] Implement N3981: Disable trigraphs by default in C++1z mode.
llvm-svn: 211392
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
-rw-r--r--clang/test/Lexer/cxx1z-trigraphs.cpp9
2 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index beaa092c1e5..4647179d6f4 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -1167,7 +1167,8 @@ void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
// Mimicing gcc's behavior, trigraphs are only enabled if -trigraphs
// is specified, or -std is set to a conforming mode.
- Opts.Trigraphs = !Opts.GNUMode;
+ // Trigraphs are disabled by default in c++1z onwards.
+ Opts.Trigraphs = !Opts.GNUMode && !Opts.CPlusPlus1z;
Opts.DollarIdents = !Opts.AsmPreprocessor;
diff --git a/clang/test/Lexer/cxx1z-trigraphs.cpp b/clang/test/Lexer/cxx1z-trigraphs.cpp
new file mode 100644
index 00000000000..410626fd7bb
--- /dev/null
+++ b/clang/test/Lexer/cxx1z-trigraphs.cpp
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -std=c++1z %s -verify
+// RUN: %clang_cc1 -std=c++1z %s -trigraphs -fsyntax-only
+
+??= define foo ; // expected-error {{}} expected-warning {{trigraph ignored}}
+
+static_assert("??="[0] == '#', ""); // expected-error {{failed}} expected-warning {{trigraph ignored}}
+
+// ??/
+error here; // expected-error {{}}
OpenPOWER on IntegriCloud