From 13b8a46e90be1bf67fef907e7b601baa64296428 Mon Sep 17 00:00:00 2001 From: yhirose Date: Fri, 24 Jan 2020 21:32:54 -0500 Subject: [PATCH] Fixed C++11 bulid errors --- peglib.h | 16 ++++++++++------ pl0/Makefile | 2 +- pl0/pl0.cc | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/peglib.h b/peglib.h index 9ea37c5..cd782a8 100644 --- a/peglib.h +++ b/peglib.h @@ -2530,9 +2530,11 @@ inline void DetectLeftRecursion::visit(Reference& ope) { } inline void HasEmptyElement::visit(Reference& ope) { - auto it = std::find_if(refs_.begin(), refs_.end(), [&](const auto& ref) { - return ope.name_ == ref.second; - }); + auto it = std::find_if(refs_.begin(), refs_.end(), + [&](const std::pair& ref) { + return ope.name_ == ref.second; + } + ); if (it != refs_.end()) { return; } @@ -2545,9 +2547,11 @@ inline void HasEmptyElement::visit(Reference& ope) { } inline void DetectInfiniteLoop::visit(Reference& ope) { - auto it = std::find_if(refs_.begin(), refs_.end(), [&](const auto& ref) { - return ope.name_ == ref.second; - }); + auto it = std::find_if(refs_.begin(), refs_.end(), + [&](const std::pair& ref) { + return ope.name_ == ref.second; + } + ); if (it != refs_.end()) { return; } diff --git a/pl0/Makefile b/pl0/Makefile index 2a685ab..d319f11 100644 --- a/pl0/Makefile +++ b/pl0/Makefile @@ -1,2 +1,2 @@ pl0: pl0.cc ../peglib.h - clang++ -std=c++14 -g -O0 pl0.cc `llvm-config --cxxflags --ldflags --system-libs --libs` -I.. -o pl0 + clang++ -std=c++11 -g -O0 pl0.cc `llvm-config --cxxflags --ldflags --system-libs --libs` -I.. -o pl0 diff --git a/pl0/pl0.cc b/pl0/pl0.cc index 2fb02cb..4595860 100644 --- a/pl0/pl0.cc +++ b/pl0/pl0.cc @@ -1,7 +1,7 @@ // // pl0.cc - PL/0 language (https://en.wikipedia.org/wiki/PL/0) // -// Copyright (c) 2018 Yuji Hirose. All rights reserved. +// Copyright (c) 2020 Yuji Hirose. All rights reserved. // MIT License //