summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C10
1 files changed, 5 insertions, 5 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
index e541bf9fbd..c4c052a607 100644
--- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C
@@ -12,13 +12,13 @@
// 2 defined before first use
// NOTE: this is only needed in contexts that require a constant-expression
struct S {
- constexpr int twice();
- constexpr int t(); // { dg-message "used but never defined" }
+ constexpr int twice() const;
+ constexpr int t() const; // { dg-message "used but never defined" }
private:
static constexpr int val = 7; // constexpr variable
};
-constexpr int S::twice() { return val + val; }
+constexpr int S::twice() const { return val + val; }
constexpr S s = { };
int x1 = s.twice(); // ok
int x2 = s.t(); // error: S::t() not defined
@@ -44,8 +44,8 @@ const double* p = &x; // the &x forces x into memory
// 1
struct complex {
constexpr complex(double r, double i) : re(r), im(i) { }
- constexpr double real() { return re; }
- constexpr double imag() { return im; }
+ constexpr double real() const { return re; }
+ constexpr double imag() const { return im; }
private:
double re;
double im;