Bug 1383477

Summary: Regex with TutorialsPoint C++ Compiler
Product: [Community] Bugzilla Reporter: Michael <mensa.guy.bassoon>
Component: Bugzilla GeneralAssignee: PnT DevOps Devs <hss-ied-bugs>
Status: CLOSED WORKSFORME QA Contact: tools-bugs <tools-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 4.4CC: huiwang, mtahir, mtyson, qgong
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Windows   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
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 Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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