diff --git a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts index ed8fbcfe9e2..7bf6cc650a9 100644 --- a/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts +++ b/core/org.eclipse.cdt.core.tests/resources/rewrite/ASTWriterDeclaratorTestSource.awts @@ -171,3 +171,10 @@ void foo() noexcept (noexcept (1 + 1)) void foo() noexcept (noexcept (1 + 1) && noexcept (2 + 3)) { } + +//!Basic UDL operator +//%CPP +constexpr long double operator ""_deg(long double deg) +{ + return deg * 3.141592 / 180; +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java index 6afe8cca260..cefa059c626 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java @@ -913,7 +913,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { IToken ident = consume(IToken.tIDENTIFIER); char[] operatorName = CharArrayUtils.concat(firstToken.getCharImage(), " ".toCharArray()); //$NON-NLS-1$ - operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage()); + operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage()); operatorName = CharArrayUtils.concat(operatorName, ident.getCharImage()); IASTName name = getNodeFactory().newOperatorName(operatorName); @@ -929,12 +929,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { int startQuote = image.indexOf('"'); int endQuote = image.lastIndexOf('"'); if (startQuote != -1 && endQuote == startQuote + 1) { - char[] ident = image.substring(endQuote + 1).toCharArray(); - char[] operatorName = CharArrayUtils.concat(firstToken.getCharImage(), " ".toCharArray()); //$NON-NLS-1$ - operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage()); - operatorName = CharArrayUtils.concat(operatorName, ident); - + operatorName = CharArrayUtils.concat(operatorName, strOp.getCharImage()); IASTName name = getNodeFactory().newOperatorName(operatorName); setRange(name, firstToken.getOffset(), strOp.getEndOffset()); return name;