From: Javier Miranda <mira...@adacore.com> The compiler does not report the correct error in occurrences of interpolated strings, when the sources are compiled without language extensions allowed.
gcc/ada/ * scng.adb (Scan): Call Error_Msg_GNAT_Extension() to report an error, when the sources are compiled without Core_Extensions_ Allowed, and the scanner detects the beginning of an interpolated string. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/scng.adb | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/gcc/ada/scng.adb b/gcc/ada/scng.adb index 08ce2ab5ad1..658970fbab2 100644 --- a/gcc/ada/scng.adb +++ b/gcc/ada/scng.adb @@ -2135,14 +2135,19 @@ package body Scng is -- Lower case letters when 'a' .. 'z' => - if Core_Extensions_Allowed - and then Source (Scan_Ptr) = 'f' + if Source (Scan_Ptr) = 'f' and then Source (Scan_Ptr + 1) = '"' then - Scan_Ptr := Scan_Ptr + 1; - Accumulate_Checksum (Source (Scan_Ptr)); - Token := Tok_Left_Interpolated_String; - return; + if Core_Extensions_Allowed then + Scan_Ptr := Scan_Ptr + 1; + Accumulate_Checksum (Source (Scan_Ptr)); + Token := Tok_Left_Interpolated_String; + return; + else + Error_Msg_GNAT_Extension + ("interpolated string", Scan_Ptr, + Is_Core_Extension => True); + end if; end if; Name_Len := 1; @@ -2155,15 +2160,20 @@ package body Scng is -- Upper case letters when 'A' .. 'Z' => - if Core_Extensions_Allowed - and then Source (Scan_Ptr) = 'F' + if Source (Scan_Ptr) = 'F' and then Source (Scan_Ptr + 1) = '"' then - Error_Msg_S - ("delimiter of interpolated string must be in lowercase"); - Scan_Ptr := Scan_Ptr + 1; - Token := Tok_Left_Interpolated_String; - return; + if Core_Extensions_Allowed then + Error_Msg_S + ("delimiter of interpolated string must be in lowercase"); + Scan_Ptr := Scan_Ptr + 1; + Token := Tok_Left_Interpolated_String; + return; + else + Error_Msg_GNAT_Extension + ("interpolated string", Scan_Ptr, + Is_Core_Extension => True); + end if; end if; Token_Contains_Uppercase := True; -- 2.45.2