Bug 1383477 - Regex with TutorialsPoint C++ Compiler
Summary: Regex with TutorialsPoint C++ Compiler
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Bugzilla
Classification: Community
Component: Bugzilla General
Version: 4.4
Hardware: x86_64
OS: Windows
unspecified
medium vote
Target Milestone: ---
Assignee: PnT DevOps Devs
QA Contact: tools-bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-10 18:08 UTC by Michael
Modified: 2016-10-11 04:41 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
http://www.tutorialspoint.com/compile_cpp11_online.php with code from https://solarianprogrammer.com/2011/10/12/cpp-11-regex-tutorial/ (don't know about component or version -- see above. I just put earliest version and bugzilla general)
Last Closed: 2016-10-11 04:41:12 UTC


Attachments (Terms of Use)

Description Michael 2016-10-10 18:08:28 UTC
Description of problem: 

brings up error on TutorialsPoint C++ Compiler, found at http://www.tutorialspoint.com/compile_cpp11_online.php.  

Instructions in error specified to go to http://bugzilla.redhat.com/bugzilla to find instructions 

Version-Release number of selected component (if applicable):??

How reproducible:  just trying to run a regex program.

Code:
-----------------------------------------
//Example 1
#include <iostream>
#include <regex>
#include <string>

using namespace std;

int main()
{
	string input;
	regex integer("(\\+|-)?[[:digit:]]+");
	//As long as the input is correct ask for another number
	while(true)
	{
		cout<<"Give me an integer!"<<endl;
		cin>>input;
		if(!cin) break;
		//Exit when the user inputs q
		if(input=="q")
			break;
		if(regex_match(input,integer))
			cout<<"integer"<<endl;
		else
		{
			cout<<"Invalid input"<<endl;
		}
	}
}
----------------------------

Steps to Reproduce:

1. copy & paste code from middle of page on https://solarianprogrammer.com/2011/10/12/cpp-11-regex-tutorial/, code is titled "regex_01.cpp"

2. compile code on TutorialsPoint at http://www.tutorialspoint.com/compile_cpp11_online.php (by pressing the "Compile" button)

3. Wait & wait & watch error message

Actual results:

sh-4.3$ g++ -std=c++11 -o main *.cpp
g++: internal compiler error: Killed (program cc1plus)          
Please submit a full bug report,               
with preprocessed source if appropriate.                                      
See <http://bugzilla.redhat.com/bugzilla> for instructions.  sh-4.3$                                                                                                                                                         

Expected results:

"Give me an integer!" with cin for input
cout Either "integer" or "Invalid input"

Additional info:

beginning C++ class, just trying to find a way to validate input with regular expressions.

Comment 1 Matt Tyson 🤬 2016-10-11 04:41:12 UTC
Hi,

You'll need to talk to tutorialspoint and ask them to upgrade their compilers.

This code sample works on g++ 5.3.1-6


Note You need to log in before you can comment on or make changes to this bug.